lh

The line height of the element it is used on.

Safe to useBaseline: widely available

First version with support, from MDN browser data
BrowserSince
Chrome109+
Chrome Android109+
Edge109+
Firefox120+
Firefox Android120+
Safari16.4+
Safari iOS16.4+

Formula 1lh = used line-height of the element

How it works

1lh is the used line height of the element. With line-height: 1.5 on a 20px font that comes to 30px, so block-size: 3lh holds exactly three lines of that text and min-block-size: 4lh makes a note panel at least four lines tall. The unit lets you size things in lines instead of guessing at pixels.

margin-block: 1lh gives paragraph spacing of exactly one blank line, in whatever font and size the paragraph uses. If line-height is normal, 1lh is the height of one line in that font, which differs from font to font, so set a number when you need the same result everywhere.

Inside the line-height property an element cannot refer to its own value, so lh there reads the parent’s. A child with line-height: 2lh under a parent whose lines are 20px tall gets 40px. And lh is a length, not a promise about the rendered text: a tall inline box, such as an 80px inline-block, stretches its line, so three lines with one such box in them are taller than 3lh.

Try it

Measure the font-relative units

Pick a font and a size. The page measures 1em, 1ex, 1ch, 1cap and 1lh in that font, here, in your browser.

UnitMeasuredShare of the font size
1em
1ex
1ch
1cap
1lh
The same as a table
What each font-relative unit measures
UnitMeasures
1emThe font size of the element.
1exHow tall the letter x is in this font.
1chThe width of the digit zero in the font.
1capThe height of a capital letter in the font.
1lhThe line height of the element.

What changes it

Moves with
  • the reader's text size
  • page zoom
Stays put under
  • the window size
  • the font in use
  • the query container
  • phone toolbars
  • the writing mode

Reach for it when

Gaps and heights counted in the element's own lines: margin-block: 1lh, min-block-size: 4lh.

Watch out

With line-height: normal, 1lh depends on the font's own metrics, and a line can grow taller than line-height when tall inline content sits in it, so 3lh is not always three rendered lines.

Example One blank line in whatever font and size the paragraph uses, instead of a number that fits one size.

Before

p + p {
  margin-block-start: 24px;
}

After

p + p {
  margin-block-start: 1lh;
}

MDN (opens in a new tab)Specification (opens in a new tab)