# Line Height Units

> The line height units in CSS are relative length units based on the line height of the element or the root element.

## What are lh and rlh units in CSS?

The units `lh` and `rlh` that are equal to the computed `line-height` of the element and the root element respectively. Useful for aligning spacing and sizes to the text rhythm.

- Topic: Measurement Units
- Type: concept
- Browser support: Chrome 109+, Chrome Android 109+, Edge 109+, Firefox 120+, Firefox Android 120+, Safari 16.4+, Safari iOS 16.4+

## Example

Wrong:

```css
p {
  line-height: 1.5;
  margin-block: 24px;
}
```

Right:

```css
p {
  line-height: 1.5;
  margin-block: 1.5em;
  margin-block: 1lh;
}
```

`1lh` spaces paragraphs by exactly one line of text, and the 'em' line acts as a fallback.

## Common mistakes

- Using `lh` inside `line-height`, where it refers to the parent's line height.

## Key points

- Spacing tied to text rhythm uses `lh` or `rlh` instead of hardcoded pixel values.
- `line-height` itself stays unitless, so `lh` follows font size changes.
- An `em` fallback is declared first where the units are unsupported.

## Interview questions

### What is the difference between lh and rlh?

`lh` is the element's own computed line height, while `rlh` is the line height of the root element.

### Is lh the same as em?

No. 'em' equals the font size, while `lh` equals the line height, which is usually larger.

### Can I use lh to size icons next to text?

Yes. A height of `1lh` makes an icon exactly as tall as one line of the surrounding text.

## Related cards

- [line-height](https://wonderium.dev/css/line-height.md)
- [Relative Length Units](https://wonderium.dev/css/relative-length-units.md)
- [rem()](https://wonderium.dev/css/rem.md)
- [font-size](https://wonderium.dev/css/font-size.md)
- [margin](https://wonderium.dev/css/margin.md)

---

- Level: [CSS](https://wonderium.dev/css.md)
- HTML version: https://wonderium.dev/css/line-height-units
- Last updated: 2026-11-25
