Readable Typography: Measure, Line Height, Vertical Rhythm and Spacing
Putting typography together: line length with ch, unitless line-height and why it inherits correctly, lh and rlh units, vertical rhythm and spacing, trimming space with text-box, keeping sup and sub from breaking lines, initial-letter drop caps.
kvi5hnuCode Sprout team member8 min readOn this page
The previous articles covered individual properties. Readable text depends on how they work together: how long the lines are, how much space is between them, and how headings, paragraphs and lists are spaced. This article puts it into practice.
Measure: line length
The measure is the length of a line. Lines that are too long make it hard to find the start of the next one; lines that are too short break the text into fragments. For body text, aim for about 45 to 75 characters per line, with around 66 as a comfortable middle. WCAG 1.4.8 (AAA) recommends no more than 80.
The ch unit, the width of the "0" glyph, makes this easy:
.prose { max-inline-size: 65ch; }
ch is an approximation: average letters are narrower than "0" in most fonts, so 65ch holds somewhat more than 65 characters. Use max-inline-size, not inline-size, so text still fits narrow screens.

Only the width changes between the three: compare how easily your eye returns to the start of the next line in each.
line-height
line-height sets the height of each line box. The extra space beyond the font's own height is the leading, split equally above and below the text as half-leading:

Body text usually reads well at 1.4 to 1.6; headings, with their larger size, need less, about 1.1 to 1.25. Long lines need a bit more line height than short ones. WCAG 1.4.12 requires that the page still works when users set it to 1.5.
Always use unitless line heights
line-height accepts a number, a length or a percentage, and they inherit differently:
| Value | What children inherit |
|---|---|
1.5 (number) | the number, recalculated for each element's own font size |
1.5em or 150% | the computed length, a fixed size from the parent |
Tested in Chrome, with a 16px parent and a 32px heading inside it: with line-height: 1.5em or 150% on the parent, the heading inherited a 24px line height, smaller than its own font, so its lines overlap; with 1.5, the heading's line height was 48px.
So set line-height as a unitless number, at least on body.

The bottom row is the inheritance trap: 150% was turned into 24px on the parent, and the large heading inherited that fixed length.
line-height: normal lets the font decide, usually about 1.2, and it varies between fonts. Tested in Chrome: 20px Arial with normal gave a 23px line.
The lh and rlh units
1lh is the element's computed line height, and 1rlh the root element's. They're useful for spacing that matches the text's rhythm:
p { margin-block: 0 1lh; } /* one blank line between paragraphs */
.icon { block-size: 1lh; } /* exactly one line tall */
Tested in Chrome: with a 20px font and line-height: 1.5, 2lh was 60px. They work in all browsers.
Vertical rhythm and spacing
Vertical rhythm means spacing elements in consistent steps, so the page has a regular structure. You don't need every element to sit on a strict baseline grid; consistent spacing tokens are what matter:
:root { --space-1: 0.5rem; --space-2: 1rem; --space-3: 1.5rem; --space-4: 2.5rem; }
Guidelines for text:
- Paragraphs: about one line of space between them,
margin-block-end: 1lhor1em, or no space and a first-line indent (article 89), but not both. - Headings: more space above than below, so a heading groups with the text it introduces. For example
margin-block: 2em 0.5em. - Lists and quotes: the same spacing as paragraphs, so they fit the flow.
- Use the owl selector
* + *ormargin-block-starton following siblings, to space elements without stray margins at the start or end (article 40 covers margin collapsing):
.prose > * + * { margin-block-start: var(--flow-space, 1em); }
.prose > :is(h2, h3) { --flow-space: 2em; }
.prose > :is(h2, h3) + * { --flow-space: 0.5em; }
Trimming extra space: text-box
Half-leading and the font's built-in spacing add space above the capitals and below the baseline. That's why a button's text often looks lower than centered, and a heading's top never lines up exactly with an image next to it. text-box trims it:
h1, .button { text-box: trim-both cap alphabetic; }
text-box is a shorthand for text-box-trim (none, trim-start, trim-end, trim-both) and text-box-edge, which says where to trim to: cap (cap height) or ex (x-height) at the top, and alphabetic (the baseline) at the bottom. Tested in Chrome: a 40px Arial line with line-height: 1.5 was 60px tall, and 29px with text-box: trim-both cap alphabetic, the height of the capitals. It works in Chrome 133, Safari 18.2 and Firefox 154.
The trim applies to the first and last lines of a block, so it doesn't change spacing between lines inside a paragraph.
Superscripts and subscripts
<sup> and <sub> raise or lower text with vertical-align, which can make a line taller than its neighbours, creating uneven spacing. Tested in Chrome: a 16px line with line-height: 1.5 was 24px tall, and 27px with an x$^{2}$ in it. Either fix brings it back to 24px:
sup, sub { line-height: 0; }
sup { vertical-align: baseline; position: relative; inset-block-start: -0.4em; }
font-variant-position: super (article 86) didn't help in this test: the <sup> element still applies vertical-align: super.
Drop caps: initial-letter
initial-letter makes a large first letter that sinks into a number of lines:
.chapter > p:first-of-type::first-letter {
-webkit-initial-letter: 3; /* Safari */
initial-letter: 3; /* three lines tall, sunk three lines */
font-weight: 700;
margin-inline-end: 0.5rem;
color: #8a3b12;
}
initial-letter: 3 2 makes it three lines tall but sunk only two. It works in Chrome 110 and Safari, which still needs -webkit-initial-letter, not Firefox, where the letter is just shown at its normal size; the old float-based drop cap is the fallback.

In the middle row, the default <sup> adds 3px to one line, and every line after it is off the 24px grid; line-height: 0 restores 96px for four lines.
A complete prose stylesheet
body { margin: 1rem; }
.prose {
max-inline-size: 65ch;
font: 0.95rem/1.6 Georgia, "Times New Roman", serif; /* unitless line height */
color: #2a2118;
}
.prose > * { margin-block: 0; }
.prose > * + * { margin-block-start: var(--flow, 1lh); } /* one line between blocks */
.prose > :is(h2, h3) { --flow: 1.6lh; line-height: 1.15; text-wrap: balance; font-family: system-ui, sans-serif; }
.prose > :is(h2, h3) + * { --flow: 0.4lh; } /* headings stay close to their text */
.prose h2 { font-size: 1.4rem; text-box: trim-start cap alphabetic; color: #8a3b12; }
.prose h3 { font-size: 1.05rem; }
.prose p { text-wrap: pretty; }
.prose > p:first-of-type::first-letter { -webkit-initial-letter: 2; initial-letter: 2; font-weight: 700; color: #8a3b12; margin-inline-end: 0.3rem; }
.prose sup { line-height: 0; }
.prose ul { padding-inline-start: 1.2em; }
It uses most of what this part covered: a 65ch measure, unitless line height, flow spacing in lh, balanced headings and pretty paragraphs, a trimmed heading top, a drop cap, and a superscript that doesn't stretch its line.
What's current
text-box: Chrome 133, Safari 18.2, Firefox 154.lhandrlhunits: all browsers.initial-letter: Chrome; Safari with-webkit-.text-wrap: pretty(article 91): Chrome and Safari.
Common questions
What line length should I use?
About 45–75 characters: max-inline-size: 65ch is a good start.
Why do my headings' lines overlap?
A parent's line-height is a length or percentage, so the heading inherits a fixed value that's too small. Use a unitless number.
Why does text in my button look off-center vertically?
The font's built-in space above capitals and below the baseline differs. text-box: trim-both cap alphabetic trims it.
Why is the line with a superscript taller?
vertical-align: super raises the text and enlarges the line box. Set sup { line-height: 0; }.
Summary
- Keep lines to about 45–75 characters with
max-inline-size: 65ch. - Use unitless
line-height, about 1.5 for body text and less for headings; lengths and percentages inherit as fixed values. lhandrlhunits match spacing to the line height.- Space consistently, with more space above headings than below.
text-boxtrims the space above capitals and below the baseline.- Stop
<sup>and<sub>from stretching lines withline-height: 0;initial-lettercreates drop caps.
Practice questions
A parent has font-size: 16px; line-height: 150%. What is the line height of a child with font-size: 40px, and how do you fix it?
Answer
24px: the percentage is computed on the parent and inherited as a length, so the child's lines overlap. Use line-height: 1.5, which gives the child 60px.
Write CSS that limits article text to a comfortable line length and puts one line of space between paragraphs.
Answer
article { max-inline-size: 65ch; line-height: 1.5; }
article p { margin-block: 0 1lh; }
What does this do?
.badge { text-box: trim-both cap alphabetic; padding: 0.4em 0.6em; }
Answer
It trims the space above the capitals and below the baseline from the badge's text, so the padding is measured from the visible letters, and the text looks centered vertically. Browsers without text-box show the normal spacing.
Why is a line containing E = mc$^{2}$ taller than the others, and what's one fix?
Answer
<sup> uses vertical-align: super, which raises the text and makes the line box taller. sup { line-height: 0; } stops it from adding height.
Review quiz
Test yourself on Part 12 with the CSS Part 12 review quiz.
Previous: Writing Modes, Direction and Vertical Text
Next: Styling Lists: list-style, Marker Position and ::marker

More in CSS Course
Quiz: CSS Delicate Details
Twenty-five questions on the edge cases that surprise experienced developers: invalid custom properties, shorthands that reset values, layer order with !important, containing blocks, margin collapsing, specificity of :is() and :where(), intrinsic minimum sizes, and more, each checked in Chrome.
Quiz: CSS Interview Questions
Thirty front-end interview questions: cascade, specificity and layers, box model and margin collapsing, stacking contexts, positioning, flexbox and grid, responsive design, custom properties, performance, accessibility, modern selectors and architecture.
Quiz: CSS Course Final Exam
Thirty questions across the whole CSS course: syntax and error handling, selectors, the cascade and layers, values and units, color, the box model, backgrounds, positioning, flexbox, grid, responsive design, typography, generated content, effects, transforms, motion and architecture.
Quiz: CSS Architecture, Tooling and Debugging (CSS Part 17)
Twenty questions on modular CSS and BEM, layering a stylesheet, design tokens and theming, pattern libraries and safe refactoring, preprocessors and build tools, the at-rules reference, and debugging common CSS problems.
Discussion
Sign in to ask a question or share what you learned.