示例工程 24-fluid-typography
24-fluid-typography/demo-02-container-type/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;
}
.cols {
display: flex;
flex-wrap: wrap;
gap: 24px;
margin-top: 16px;
}
.cols section {
min-width: 0;
}
h2 {
font-size: 13px;
color: #64748b;
}
.host {
container-type: inline-size;
margin-top: 10px;
border: 1px dashed #cbd5e1;
border-radius: 8px;
background: #ffffff;
}
.w-280 { width: 280px; }
.w-560 { width: 560px; max-width: 100%; }
.host p {
margin: 0;
padding: 12px;
font-weight: 700;
line-height: 1.2;
}
.cqi { font-size: clamp(1rem, 8cqi, 2rem); }
.vw { font-size: clamp(1rem, 8vw, 2rem); }