CKTIS / CSS
lh — line-height unit
The lh unit ties lengths to an element’s line-height. It aligns spacing with the text rhythm but does not measure actual rendered lines.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
<number>lhlh is a relative length unit based on the element’s computed line-height. For normal, the browser derives a length using only the metrics of the first available font.
Unlike em, which refers to font-size, lh refers to line height; rlh uses the root element. In line-height or font-affecting properties, lh uses the parent’s metrics to avoid a circular dependency. Without a parent, initial values provide the basis.
height: 3lh does not guarantee exactly three visible lines: content can enlarge actual line boxes. In the example, 16px × 1.5 = 24px, so padding-block: 1lh produces 24px of padding at both the top and bottom.
Examples
<!doctype html>
<meta charset="utf-8">
<title>lh unit</title>
<style>
#sample {
font-size: 16px;
line-height: 1.5;
padding-block: 1lh;
margin: 0;
}
</style>
<p id="sample">Line-height spacing</p>Result
#sample: line-height = 24px; padding-top = 24px; padding-bottom = 24px
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.