示例工程 27-design-tokens
27-design-tokens/demo-02-scales/style.css
点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。
:root {
--space-1: 0.25rem;
--space-2: 0.5rem;
--space-3: 0.75rem;
--space-4: 1rem;
--space-6: 1.5rem;
--space-8: 2rem;
--text-xs: 0.75rem;
--text-sm: 0.875rem;
--text-base: 1rem;
--text-lg: 1.125rem;
--text-xl: 1.5rem;
--text-3xl: 2rem;
}
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;
}
.pane {
max-width: 680px;
margin-top: 18px;
padding: 14px;
border: 1px solid #e2e8f0;
border-radius: 10px;
background: #ffffff;
}
h2 {
margin: 0 0 8px;
font-size: 13px;
color: #64748b;
}
.space-row {
display: grid;
grid-template-columns: 96px minmax(0, 1fr);
align-items: center;
gap: 8px;
padding: 4px 0;
}
code {
font-family: ui-monospace, monospace;
font-size: 10px;
color: #64748b;
}
.chips {
display: flex;
gap: var(--space-2);
}
.chips i {
width: 20px;
height: 20px;
border-radius: 4px;
background: #2563eb;
}
.s1 { gap: var(--space-1); }
.s2 { gap: var(--space-2); }
.s3 { gap: var(--space-3); }
.s4 { gap: var(--space-4); }
.s6 { gap: var(--space-6); }
.s8 { gap: var(--space-8); }
.t3xl { font-size: var(--text-3xl); font-weight: 700; line-height: 1.2; }
.txl { font-size: var(--text-xl); font-weight: 600; }
.tlg { font-size: var(--text-lg); font-weight: 600; }
.tbase { font-size: var(--text-base); }
.tsm { font-size: var(--text-sm); color: #64748b; }
.txs { font-size: var(--text-xs); color: #64748b; }