DeepLearning101 commited on
Commit
3f62c66
·
verified ·
1 Parent(s): aff2455

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -23
app.py CHANGED
@@ -132,50 +132,50 @@ def check_login(user, password):
132
  error_msg: "<span style='color: red'>❌ 帳號或密碼錯誤</span>"
133
  }
134
 
135
- # --- 🔥 [核彈級 CSS 重置]:強制回歸原始表格行為 ---
136
  custom_css = """
137
- /* 1. 外層容器:負責產生捲軸,並強制為區塊元素 */
138
  .table-wrap, .wrap, .svelte-12cmxck, div[id^="dataframe"] {
139
  overflow-x: auto !important;
140
- overflow-y: hidden !important;
141
  display: block !important;
142
- width: 100% !important;
143
- max-width: 100vw !important;
144
  }
145
 
146
- /* 2. 表格本體:強制使用表格佈局,禁止 Flex/Grid 干擾 */
 
 
 
 
147
  table {
148
  display: table !important;
149
  table-layout: auto !important;
150
- width: max-content !important; /* 核心:內容多少就撐多寬,超出就滾動 */
151
  min-width: 100% !important;
152
  border-collapse: collapse !important;
153
  margin: 0 !important;
154
  }
155
 
156
- /* 3. 強制橫向排列 (解決變垂直堆疊的問題) */
157
- thead { display: table-header-group !important; }
158
- tbody { display: table-row-group !important; }
159
- tr { display: table-row !important; }
160
-
161
- /* 4. 儲存格:死都不換行,自動寬度 */
162
  th, td {
163
  display: table-cell !important;
164
- white-space: nowrap !important; /* 禁止換行 */
165
- width: auto !important;
166
- max-width: none !important; /* 移除任何最大寬度限制 */
167
 
168
  box-sizing: border-box !important;
169
- padding: 10px 15px !important; /* 增加一點間距讓手指好滑 */
170
  border: 1px solid #444 !important;
171
-
172
- /* 確保內容可見 */
173
- visibility: visible !important;
174
- opacity: 1 !important;
175
  }
176
 
177
- /* 5. 隱藏 Gradio 可能產生手機版卡片視圖元素 */
178
- .mobile-view, .cards, .card { display: none !important; }
 
 
 
179
  """
180
 
181
  # --- 介面開始 (加入 css 參數) ---
 
132
  error_msg: "<span style='color: red'>❌ 帳號或密碼錯誤</span>"
133
  }
134
 
135
+ # --- 🔥 [1% 黑科技 CSS]:強制縮小擠壓,適配內容寬度 ---
136
  custom_css = """
137
+ /* 1. 外層容器:允許左右滑動 */
138
  .table-wrap, .wrap, .svelte-12cmxck, div[id^="dataframe"] {
139
  overflow-x: auto !important;
 
140
  display: block !important;
 
 
141
  }
142
 
143
+ /* 2. 表格本體:
144
+ display: table -> 強制表格行為 (修復垂直堆疊)
145
+ width: auto -> 寬度依內容決定,不強制撐滿
146
+ table-layout: auto -> 自動計算欄寬
147
+ */
148
  table {
149
  display: table !important;
150
  table-layout: auto !important;
151
+ width: auto !important;
152
  min-width: 100% !important;
153
  border-collapse: collapse !important;
154
  margin: 0 !important;
155
  }
156
 
157
+ /* 3. 欄位設定:
158
+ width: 1px -> 【核心技巧】這會強迫瀏覽器把欄位縮到最小
159
+ white-space: nowrap -> 但因為禁止換行,所以最小寬度 = 文字寬度
160
+ 結果:完美的「內容自適應寬度」
161
+ */
 
162
  th, td {
163
  display: table-cell !important;
164
+ white-space: nowrap !important;
165
+
166
+ width: 1px !important; /* 👈 這是重點,不要怕,它不會真的變 1px */
167
 
168
  box-sizing: border-box !important;
169
+ padding: 10px 15px !important;
170
  border: 1px solid #444 !important;
171
+ vertical-align: middle !important;
 
 
 
172
  }
173
 
174
+ /* 4. 針對表頭特別修正 */
175
+ thead tr th {
176
+ background-color: #333 !important;
177
+ font-weight: bold !important;
178
+ }
179
  """
180
 
181
  # --- 介面開始 (加入 css 參數) ---