示例工程 10-sizing-overflow
10-sizing-overflow/demo-01-sizing/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: 28px;
}
.box {
margin-top: 12px;
padding: 12px 14px;
border-radius: 8px;
background: #0f172a;
color: #e2e8f0;
font-family: ui-monospace, Menlo, monospace;
font-size: 12px;
}
.min {
width: min(100%, 420px);
}
.clamp {
width: clamp(240px, 60%, 520px);
background: #2563eb;
}
.max {
width: 100%;
max-width: 600px;
background: #7c3aed;
}