Update app.py
Browse files
app.py
CHANGED
|
@@ -132,50 +132,50 @@ def check_login(user, password):
|
|
| 132 |
error_msg: "<span style='color: red'>❌ 帳號或密碼錯誤</span>"
|
| 133 |
}
|
| 134 |
|
| 135 |
-
# --- 🔥 [
|
| 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. 表格本體:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
table {
|
| 148 |
display: table !important;
|
| 149 |
table-layout: auto !important;
|
| 150 |
-
width:
|
| 151 |
min-width: 100% !important;
|
| 152 |
border-collapse: collapse !important;
|
| 153 |
margin: 0 !important;
|
| 154 |
}
|
| 155 |
|
| 156 |
-
/* 3.
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
/* 4. 儲存格:死都不換行,自動寬度 */
|
| 162 |
th, td {
|
| 163 |
display: table-cell !important;
|
| 164 |
-
white-space: nowrap !important;
|
| 165 |
-
|
| 166 |
-
|
| 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 |
-
/*
|
| 178 |
-
|
|
|
|
|
|
|
|
|
|
| 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 參數) ---
|