示例工程 20-responsive-units
20-responsive-units/demo-01-px-rem-em/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: 0 0 6px;
font-size: 13px;
color: #64748b;
}
.pane {
max-width: 560px;
margin-top: 18px;
padding: 12px;
border: 1px dashed #cbd5e1;
border-radius: 8px;
background: #ffffff;
}
.level-1,
.level-2,
.level-3 {
padding: 8px;
border-radius: 6px;
color: #ffffff;
font-family: ui-monospace, monospace;
}
.level-1 { background: #1d4ed8; }
.level-2 { background: #2563eb; margin-top: 6px; }
.level-3 { background: #3b82f6; margin-top: 6px; }
.px-1, .px-2, .px-3 { font-size: 16px; }
.rem-1, .rem-2, .rem-3 { font-size: 1rem; }
.em-1 { font-size: 20px; }
.em-2 { font-size: 1.5em; }
.em-3 { font-size: 1.5em; }