Sub topic 8
Why the typeface changes the answer
This chapter assumes you know what leading and measure are, and that you can read basic CSS. It builds on the earlier chapters about choosing a leading value and about how measure and leading interact.
Same size, different texture
Two typefaces set at 16px are not the same size on the page. The font size is the height of an invisible box around each letter. How much of that box the letters fill depends on the design. So a leading ratio that works for one typeface can look cramped or loose in another.
Four features of a typeface matter most.
- x-height is the height of lowercase letters such as x, a, and e, measured from the baseline. A large x-height makes the text look bigger and denser, so it usually needs more leading.
- Ascenders and descenders are the parts of letters like b, d, p, and g that reach above or below the x-height. Long ones add white space between lines. Short ones leave less.
- Letter width varies between designs. A wide typeface fits fewer characters on a line, so a
ch-based measure gives a physically wider line. - Stroke contrast and weight change how dark the text looks. Heavy, low-contrast strokes make a dense block that benefits from extra space between lines.
What this looks like in practice
Take two common cases. A typeface with a large x-height, such as Verdana, looks tall and dense at a normal size. A typeface with a modest x-height and short descenders, such as Garamond, looks lighter at the same size. If both use line-height: 1.5, the first can feel tight and the second can feel airy.
The ratios below are starting points, not rules. The exact numbers depend on the font files you load.
| Typeface trait | Effect on a paragraph | Leading adjustment |
|---|---|---|
| Large x-height | Dense, looks bigger | Add a little, for example 1.6 |
| Small x-height | Light, looks smaller | Keep or trim, for example 1.4 to 1.5 |
| Long ascenders and descenders | Extra built-in white space | Often need less added leading |
| Heavy weight | Dark, compact color | Add a little |
| Light weight | Pale, open color | Keep or trim |
Setting it in CSS
Keep one sensible default on body. Then override it per typeface, so the adjustment travels with the font and not with each paragraph. Use unitless values, so the leading scales with each element's own font size.
body {
font-size: 1rem;
line-height: 1.5;
}
.text-large-x-height {
font-family: Verdana, sans-serif;
line-height: 1.6;
}
.text-small-x-height {
font-family: Garamond, "Times New Roman", serif;
line-height: 1.45;
}
p {
max-width: 65ch;
}The ch unit is the width of the zero character in the element's current font. So the same 65ch is a different pixel width in each typeface. That is usually what you want, because it keeps the character count per line steady. Check the result, though, because ch is only an approximation of an average character.
A quick routine
- Set the paragraph with your default leading, such as 1.5.
- Step back and squint. The text should look like an even gray block, with no stripes of white or dark bands.
- If lines seem to collide, raise leading in steps of 0.05 to 0.1.
- If lines seem to drift apart, lower it by the same steps.
- Repeat for each typeface in the design.
Exercise
You switch body text from a typeface with a small x-height to one with a large x-height. Both are 1rem with line-height 1.5, and the text now looks cramped. What do you change, and why does the font size not explain the problem?
Show answer
Raise the unitless line-height slightly, for example to 1.6, and check by eye. The font size is the same, but a large x-height makes the lowercase letters fill more of the line box, so the text looks bigger and denser and has less visible white space between lines.