DeepLearning101 commited on
Commit
2dba68f
·
verified ·
1 Parent(s): 51a7e20

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -14
app.py CHANGED
@@ -133,35 +133,33 @@ def check_login(user, password):
133
  error_msg: "<span style='color: red'>❌ 帳號或密碼錯誤</span>"
134
  }
135
 
136
- # --- 🔥 [終極修正 CSS]:使用 max-content 強制撐開 ---
137
  custom_css = """
138
- /* 1. 確保外層容器可以捲動 */
139
- .table-wrap, .wrap, .svelte-12cmxck, div[data-testid="dataframe"] > div {
140
  overflow-x: auto !important;
 
141
  }
142
 
143
- /* 2. 核心:強制表格寬度為「內容總寬度」,不要被螢幕寬度限制 */
144
  table {
145
- width: max-content !important;
 
146
  min-width: 100% !important;
147
- table-layout: auto !important;
148
  }
149
 
150
- /* 3. 單元格設定:不換行、顯示完整文字 */
151
  td, th {
152
- white-space: nowrap !important;
153
- overflow: visible !important;
154
- text-overflow: clip !important; /* 移除 ... */
155
- max-width: none !important;
156
  width: auto !important;
157
- padding: 12px !important; /* 增加間距比較好點擊 */
 
 
 
 
158
  }
159
 
160
- /* 4. 針對 Gradio 內部的 span 文字容器也強制不換行 */
161
  td > span, th > span {
162
  white-space: nowrap !important;
163
  overflow: visible !important;
164
- text-overflow: clip !important;
165
  }
166
  """
167
 
 
133
  error_msg: "<span style='color: red'>❌ 帳號或密碼錯誤</span>"
134
  }
135
 
136
+ # --- 🔥 [平衡版 CSS]:依文字長度自動調整 ---
137
  custom_css = """
138
+ .table-wrap, .svelte-12cmxck {
 
139
  overflow-x: auto !important;
140
+ width: 100% !important;
141
  }
142
 
 
143
  table {
144
+ table-layout: auto !important;
145
+ width: auto !important;
146
  min-width: 100% !important;
147
+ border-collapse: collapse !important;
148
  }
149
 
 
150
  td, th {
151
+ white-space: nowrap !important;
 
 
 
152
  width: auto !important;
153
+ max-width: 400px !important; /* 限制最大寬度,避免 User ID 撐太開 */
154
+ overflow: visible !important;
155
+ text-overflow: clip !important;
156
+ padding: 8px 12px !important;
157
+ vertical-align: middle !important;
158
  }
159
 
 
160
  td > span, th > span {
161
  white-space: nowrap !important;
162
  overflow: visible !important;
 
163
  }
164
  """
165