font-weight: 400; /* normal */font-weight: 700; /* bold */font-weight: lighter; /* one step lighter than parent */font-weight: bolder; /* one step heavier than parent */font-style: normal;font-style: italic; /* uses italic variant */font-style: oblique; /* mathematically skewed *//* variable fonts — any weight value */font-weight: 350;
04. Spacing — line-height & letter-spacing
line-height controls vertical rhythm — set it as a unitless number so it scales with font size. Drag the sliders in the demo.
<div class="sp-controls"> <div class="ctrl"> <span class="ctrl-label">line-height: <span id="sp-lh-val">1.5</span> </span> <input type="range" min="1" max="2.5" step="0.1" value="1.5" id="sp-lh" /> </div> <div class="ctrl"> <span class="ctrl-label">letter-spacing: <span id="sp-ls-val">0</span>em</span> <input type="range" min="-0.05" max="0.2" step="0.01" value="0" id="sp-ls" /> </div></div><p class="sp-text" id="sp-text">Typography is the art of arranging letters and text in a way that makes the copy legible and visually appealing.</p>
/* line-height — unitless is best */line-height: 1; /* tight — display/headings */line-height: 1.4; /* compact — UI text */line-height: 1.6; /* comfortable — body text */line-height: 1.8; /* relaxed — long-form reading *//* letter-spacing — use em so it scales with font-size */letter-spacing: -0.02em; /* tighter — large headings */letter-spacing: 0.05em; /* looser — small caps, labels */letter-spacing: 0.1em; /* very open — uppercase labels */word-spacing: 0.1em;
05. Text Utilities
One-liner properties that handle alignment, transformation, and decoration.
<div class="tu-rows"> <div class="tu-row"><span class="tu-label">text-align</span> <div style="flex:1;background:#f1f5f9;padding:.3rem .5rem;border-radius:4px"><div style="text-align:center">centered text</div></div></div> <div class="tu-row"><span class="tu-label">uppercase</span> <div class="tu-demo" style="text-transform:uppercase">transformed to uppercase</div></div> <div class="tu-row"><span class="tu-label">line-through</span> <div class="tu-demo" style="text-decoration:line-through">struck through text</div></div> <div class="tu-row"><span class="tu-label">ellipsis</span> <div class="tu-demo truncate-box">Very long text that will be truncated with an ellipsis</div></div> <div class="tu-row"><span class="tu-label">text-wrap: balance</span> <div class="tu-demo balance-box">A heading that wraps evenly on both lines</div></div></div>