.hairline-table {
border-collapse: collapse; /* 合併相鄰邊框為單線 */
width: 100%;
}
.hairline-table th,
.hairline-table td {
border: 1px solid #ddd; /* 統一單像素實線 */
padding: 10px 12px;
}
.hairline-table {
border-collapse: collapse;
border: 1px solid #006600; /* 外框深綠 */
}
.hairline-table thead th {
border-color: #009900; /* 表頭中綠 */
background: #e8f5e9;
}
.hairline-table tbody td {
border-color: #ddd; /* 內格淺灰 */
}
.hairline-table tbody tr:last-child td {
border-bottom-color: #006600; /* 底部外框呼應頂部 */
}
.rounded-table {
border-collapse: separate; /* 必須 separate 才能 border-radius */
border-spacing: 0; /* 消除間隙 */
border: 1px solid #ccc;
border-radius: 8px;
overflow: hidden; /* 裁切內部直角 */
width: 100%;
}
.rounded-table th:first-child { border-top-left-radius: 6px; }
.rounded-table th:last-child { border-top-right-radius: 6px; }
.rounded-table tbody tr:last-child td:first-child { border-bottom-left-radius: 6px; }
.rounded-table tbody tr:last-child td:last-child { border-bottom-right-radius: 6px; }
.minimal-table {
border-collapse: collapse;
}
.minimal-table th,
.minimal-table td {
border: none;
border-bottom: 1px solid #eee; /* 僅底部分隔線 */
padding: 12px 16px;
}
.minimal-table thead th {
border-bottom-width: 2px;
border-bottom-color: #333;
font-weight: 600;
text-align: left;
}
.minimal-table tbody tr:last-child td {
border-bottom: none; /* 最後一列無分隔線 */
}
.minimal-table tbody tr:hover td {
background: #f5f5f5; /* 懸停列高亮 */
}
<tr style="border:..."> 無效,邊框只能套用於 table、th、td (或 col 配合 border-collapse:collapse)。border-collapse: collapse 時 border-radius 於 table 無效。box-sizing: border-box 確保 padding 不撐大儲存格。table-layout: fixed 提升渲染效能。靈活運用 border-collapse 模式、層級化顏色與圓角技巧,能實現從資料密集型後台表格到極簡展示型表格的多樣視覺需求。