cwadayi commited on
Commit
f72f5ad
·
verified ·
1 Parent(s): 8fe26ab

Update ui/layouts.py

Browse files
Files changed (1) hide show
  1. ui/layouts.py +22 -2
ui/layouts.py CHANGED
@@ -82,6 +82,28 @@ def create_ui(visit_count_html: str, theme: gr.Theme):
82
  .custom-header { padding: 3rem 1rem; border-radius: 0; }
83
  .custom-header h1 { font-size: 2.5rem; }
84
  .custom-header p { font-size: 1.2rem; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  }
86
  </style>
87
  <div class="custom-header">
@@ -91,8 +113,6 @@ def create_ui(visit_count_html: str, theme: gr.Theme):
91
  """
92
  )
93
 
94
- # --- ✨ 修改圖片路徑以符合與 app.py 同層目錄 ---
95
- # 請確保 'homepage_image.png' 就是您的圖片檔名
96
  with gr.Row(elem_classes="homepage-image-container"):
97
  gr.Image(value="homepage_image.png", show_label=False, interactive=False, container=False)
98
 
 
82
  .custom-header { padding: 3rem 1rem; border-radius: 0; }
83
  .custom-header h1 { font-size: 2.5rem; }
84
  .custom-header p { font-size: 1.2rem; }
85
+
86
+ /* ✨ 為手機顯示調整 Tabs 樣式,強制換行並平均分佈 */
87
+ /* 目標 Gradio 的 Tab 容器類別為 .gradio-tabs */
88
+ .gradio-tabs .tabs-nav {
89
+ display: flex; /* 使用 flexbox 佈局 */
90
+ flex-wrap: wrap; /* 允許項目換行 */
91
+ justify-content: space-around; /* 均勻分佈項目 */
92
+ gap: 5px; /* 項目間距 */
93
+ padding: 5px; /* 內邊距 */
94
+ }
95
+
96
+ /* 目標 Gradio 的單個 Tab 項目類別為 .gradio-tabs > button */
97
+ .gradio-tabs .tabs-nav > button {
98
+ flex: 1 1 auto; /* 允許項目彈性增長和縮小,並有基礎寬度 */
99
+ min-width: calc(33% - 10px); /* 每行顯示3個,考慮到 gap */
100
+ max-width: calc(50% - 10px); /* 小螢幕時至少顯示2個 */
101
+ box-sizing: border-box; /* 確保 padding 和 border 包含在寬度內 */
102
+ text-align: center;
103
+ white-space: normal; /* 允許文字換行 */
104
+ padding: 8px 5px; /* 調整 padding */
105
+ font-size: 0.85rem; /* 調整字體大小 */
106
+ }
107
  }
108
  </style>
109
  <div class="custom-header">
 
113
  """
114
  )
115
 
 
 
116
  with gr.Row(elem_classes="homepage-image-container"):
117
  gr.Image(value="homepage_image.png", show_label=False, interactive=False, container=False)
118