CSS line-height Property Explained

What the CSS line-height property does, with an example.

Published November 6, 2026

line-height sets the height of text lines. A unitless value (like 1.5) is multiplied by the element's font size and inherits correctly.

How it works

Good body text uses about 1.4–1.6; headings use tighter values (1.1–1.3). Unitless values are preferred over px or em, which inherit as computed lengths.

Line height also affects vertical rhythm and readability.

Values and effects

line-height: 1.5; → unitless multiplier (recommended)
line-height: 24px; → fixed length
line-height: normal; → browser default ~1.2
line-height: 1; → tight, for single lines

Practical examples

Body text

body { line-height: 1.6; }

Headings

h1, h2 { line-height: 1.2; }

Vertically centre single line text

.btn { height: 40px; line-height: 40px; }

Common mistakes

  • Using px or em and getting odd inheritance.
  • Too tight line-height reducing readability.
  • Using line-height to centre multi-line text.

Key takeaways

  • line-height in one line: line-height sets the height of text lines.
  • Inspect it live in DevTools → Styles.
  • Test across browsers and screen sizes.

FAQ

Why unitless?

Children recalculate it from their own font size; fixed lengths inherit as-is.

Is line-height supported in all browsers?

Yes in all modern browsers; check caniuse.com for edge cases.

More CSS articles