Educational guide to line-height
Give each line room
Compare factors, percentages, and lengths. Follow the inherited value and let text grow without clipping.
Mental model
line-height contributes to line box size. In horizontal writing it controls their height; in vertical writing, their width. It does not change nominal letter size or equal the visible empty space between letters.
- Font and size
font-size scales the font; accents, ascenders, and descenders can occupy different heights across families.
- Room for the line
In a text block, line-height contributes a minimum height to each horizontal line. Inline content can make it grow.
- Lines inside the block
More lines or larger line spacing make an automatically sized block grow. margin and padding handle spacing outside and inside its box.
normal, factors, and lengths
normal leaves calculation to the browser and font: it is not a constant equal to 1.2. A unitless number multiplies the element’s font-size. A percentage or em also starts from that font size but computes to a length; rem uses the root.
The same font with five values
normal
Trees and pages
to keep reading
1.5
Trees and pages
to keep reading
150%
Trees and pages
to keep reading
1.5em
Trees and pages
to keep reading
1.5rem
Trees and pages
to keep reading
px and other lengths are valid too, but keep a computed distance when inherited. Numbers, lengths, and percentages accept zero and positive values, not negatives. A valid value can be too small to read without overlap.
What actually inherits
1.5 inherits as a factor, applied to each child’s size. 150% and 1.5em compute where they are declared; descendants inherit that length. Explicitly using inherit preserves this behavior.
A 1.125rem parent and a 1.5rem child
1.5 · Parent font
Child text
to keep reading
150% · Parent font
Child text
to keep reading
1.5em · Parent font
Child text
to keep reading
1.5rem · Parent font
Child text
to keep reading
Declaring 150% directly on the child calculates it from that child’s font and changes the result. Unlike font-size: 150%, a line-height percentage uses the font of the element where it is declared. A unitless factor is usually more predictable for components with several text sizes.
The line box can grow
A larger word, an inline image, or different alignment can enlarge a line. The paragraph’s line-height does not fix every line’s total height or clip ink that extends beyond the metrics.
A larger word on the first line
Uniform text
Tree and text on the same line
to keep reading
A larger span
Tree and text on the same line
to keep reading
The explicit break makes comparison easier, but text may wrap earlier on mobile. Do not assume a paragraph’s height equals line count × line-height when it mixes sizes, fonts, or inline elements. Test the fallback font too.
Reading and user preferences
For paragraphs, start with a unitless factor of at least 1.5 and adjust it to the font, size, and line length. Paragraph spacing is controlled separately. A box that can grow preserves content when spacing increases.
A block that grows with its text
Reading at a steady pace means distinguishing one line from the next. Proportional line spacing helps you follow the words when text runs across several lines.
Space between paragraphs signals a new idea. Let the box grow when letter size or available width changes.
Read the WCAG text spacing criterionWCAG 2.2, 1.4.12 requires content and functionality to remain available when the user jointly sets line height to 1.5 times the font size, paragraph spacing to 2 times, letter spacing to 0.12 times, and word spacing to 0.16 times. It does not require these as the design’s initial values or require custom controls. Setting line-height: 1.5 alone does not establish conformance.
Clipping and the relationship with text-box
If a heading leaves space above capitals or below its last line, reducing line-height also affects the rhythm between lines. text-box can adjust the block’s outer edges to chosen metrics while retaining spacing between its interior lines.
line-height: 1 or 0 does not magically remove font metrics. It can leave accents and descenders outside the box or bring lines too close together. Clipping overflow or a fixed height can hide that ink and additional content.
Allow automatic height and wrapping, and check text at 200%, reflow at 320 CSS pixels, and custom spacing. Review accents, descenders, translations, and fallback fonts. The text-box guide offers a specific comparison and explains its separate support.
See line spacing and block edges in the text-box guideCommon pitfalls
A subheading inherits cramped lines
- Expected result
- Line spacing follows each text size.
- Cause
- A percentage or length was computed from the parent’s smaller font and inherited without recalculation.
- Solution
- Use a unitless factor on the ancestor or declare the relative value directly on the element whose size changes.
Letters on neighboring lines overlap
- Expected result
- Accents and descenders remain distinct from the neighboring line.
- Cause
- A value that is too low reserves less room than that font’s ink needs.
- Solution
- Increase line spacing and review real text. For aligning a heading’s outer edges, see text-box and its fallback.
Custom spacing hides the end
- Expected result
- All text and links remain available.
- Cause
- A fixed height or clipping limits the block as line count and spacing increase.
- Solution
- Let content grow and remove clipping that hides it; check size and spacing together.
Support and compatibility
The line-height values used here are Baseline Widely Available. normal does not promise the same result across fonts, systems, or browsers. text-box support is assessed separately.
Examples show real browser layout without measuring or simulating lines with JavaScript. A computed-style reading does not certify readability, unclipped ink, or user preferences: also check the visual result and navigation.