示例工程 30-tables-lists
30-tables-lists/demo-01-table/style.css
点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。
body {
margin: 0;
padding: 32px;
background: #f8fafc;
color: #0f172a;
font-family: system-ui, sans-serif;
line-height: 1.7;
}
h1 {
margin: 0 0 8px;
font-size: 26px;
}
.wrap {
max-height: 240px;
max-width: 560px;
margin-top: 16px;
overflow: auto;
border: 1px solid #e2e8f0;
border-radius: 10px;
}
table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
font-size: 13px;
}
caption {
padding: 10px 12px;
color: #64748b;
font-size: 11px;
text-align: left;
}
th,
td {
padding: 8px 12px;
border-bottom: 1px solid #e2e8f0;
text-align: left;
white-space: nowrap;
}
thead th {
position: sticky;
top: 0;
background: #ffffff;
color: #64748b;
font-size: 11px;
font-weight: 600;
}
tbody tr:nth-child(even) { background: #f8fafc; }
@media (hover: hover) {
tbody tr:hover { background: #eff6ff; }
}
.num {
text-align: right;
font-variant-numeric: tabular-nums;
}