Update app.py
Browse files
app.py
CHANGED
|
@@ -133,43 +133,42 @@ def check_login(user, password):
|
|
| 133 |
error_msg: "<span style='color: red'>❌ 帳號或密碼錯誤</span>"
|
| 134 |
}
|
| 135 |
|
| 136 |
-
# --- 🔥 [
|
| 137 |
custom_css = """
|
| 138 |
-
/* 1.
|
| 139 |
-
|
| 140 |
overflow-x: auto !important;
|
| 141 |
-
max-width: 100vw !important; /* 確保容器本身不超過螢幕寬 */
|
| 142 |
display: block !important;
|
| 143 |
}
|
| 144 |
|
| 145 |
/* 2. 表格本體:
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
這會迫使外層容器產生捲軸,而不是壓縮表格。
|
| 149 |
*/
|
| 150 |
table {
|
| 151 |
-
|
| 152 |
width: auto !important;
|
| 153 |
border-collapse: collapse !important;
|
| 154 |
}
|
| 155 |
|
| 156 |
-
/* 3. 欄位設定:
|
|
|
|
|
|
|
|
|
|
| 157 |
td, th {
|
| 158 |
-
white-space: nowrap !important;
|
| 159 |
-
|
| 160 |
-
text-overflow: clip !important; /* 移除 ... */
|
| 161 |
-
|
| 162 |
-
/* 移除寬度限制,讓內容自己決定要多寬 */
|
| 163 |
max-width: none !important;
|
| 164 |
width: auto !important;
|
| 165 |
|
| 166 |
-
padding: 8px 12px !important;
|
|
|
|
| 167 |
}
|
| 168 |
|
| 169 |
-
/* 4.
|
| 170 |
td > span, th > span {
|
| 171 |
white-space: nowrap !important;
|
| 172 |
-
|
| 173 |
}
|
| 174 |
"""
|
| 175 |
|
|
|
|
| 133 |
error_msg: "<span style='color: red'>❌ 帳號或密碼錯誤</span>"
|
| 134 |
}
|
| 135 |
|
| 136 |
+
# --- 🔥 [回歸傳統 CSS]:不換行 + 強制捲動 ---
|
| 137 |
custom_css = """
|
| 138 |
+
/* 1. 外層容器:強制開啟水平捲軸 */
|
| 139 |
+
.table-wrap, .svelte-12cmxck, .wrap {
|
| 140 |
overflow-x: auto !important;
|
|
|
|
| 141 |
display: block !important;
|
| 142 |
}
|
| 143 |
|
| 144 |
/* 2. 表格本體:
|
| 145 |
+
width: auto -> 內容多少寬度就多少
|
| 146 |
+
table-layout: auto -> 自動依內容計算
|
|
|
|
| 147 |
*/
|
| 148 |
table {
|
| 149 |
+
table-layout: auto !important;
|
| 150 |
width: auto !important;
|
| 151 |
border-collapse: collapse !important;
|
| 152 |
}
|
| 153 |
|
| 154 |
+
/* 3. 欄位設定:
|
| 155 |
+
white-space: nowrap -> 死都不准換行 (這會把表格撐寬)
|
| 156 |
+
max-width: none -> 移除任何寬度限制
|
| 157 |
+
*/
|
| 158 |
td, th {
|
| 159 |
+
white-space: nowrap !important;
|
| 160 |
+
min-width: 10px !important; /* 防止縮太小 */
|
|
|
|
|
|
|
|
|
|
| 161 |
max-width: none !important;
|
| 162 |
width: auto !important;
|
| 163 |
|
| 164 |
+
padding: 8px 12px !important;
|
| 165 |
+
border: 1px solid #444 !important; /* 加上邊框比較清楚 */
|
| 166 |
}
|
| 167 |
|
| 168 |
+
/* 4. Gradio 內部的 span */
|
| 169 |
td > span, th > span {
|
| 170 |
white-space: nowrap !important;
|
| 171 |
+
display: inline-block !important;
|
| 172 |
}
|
| 173 |
"""
|
| 174 |
|