示例工程 19-layout-comparison
19-layout-comparison/demo-01-cards/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;
}
h2 {
margin: 18px 0 6px;
font-size: 13px;
color: #64748b;
}
.cards {
max-width: 520px;
padding: 8px;
border: 1px dashed #cbd5e1;
border-radius: 8px;
background: #ffffff;
gap: 8px;
}
.flex {
display: flex;
flex-wrap: wrap;
}
.flex .card {
flex: 1 1 140px;
}
.grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.card {
display: grid;
place-items: center;
min-height: 56px;
border-radius: 6px;
background: #2563eb;
color: #ffffff;
font-size: 12px;
font-family: ui-monospace, monospace;
}