CSS leading 2026-11-05
CSS leading is the extra allowance around the font ascent and font descent when CSS constructs the vertical extent associated with a glyph. Let be the positive ascent, the positive descent magnitude and the selected line height, all at the same font size and in the same units. The extra leading and the resulting extents above and below the text baseline areThe half-leading is a layout allocation. It need not be a visible blank strip, and may be negative.[ref]
This explains a subtle effect of mixing fonts. In a simple baseline-aligned line containing only ordinary text CSS inline boxes, include the block's CSS strut among the contributions indexed by . The CSS line box must extend far enough in each direction, givingThe two maxima can come from different contributions. Suppose one has CSS pixels, giving , while another has , giving . If the CSS strut adds no larger extent, the resulting CSS line box is CSS pixels high, exceeding both declared line heights. The assumption of a common text baseline matters: other vertical alignments and inline objects require the fuller layout rules.[ref]
Visual formatting model details in CSS 2.2 by W3C. §10.8, uppermost and lowermost box edges; §10.8.1, block-container strut
Thus a stored font line gap, an individual line height declaration and the final CSS line box height are distinct quantities. Comparing only nominal font sizes cannot explain the mixed-font result.
Font ascent 2026-11-05
The font ascent is an upward metric measured from a text baseline and used when allocating vertical space for a font. It describes the font's layout metrics as a whole, rather than the visible ascender of one particular glyph. A short letter, a tall letter and an accented form can therefore share the same font ascent while having different ink bounding boxes.[ref]
Suppose a computer font has a chosen font ascent of 800 font units and 1000 font units per em. At 20 pixels per em, the scaled upward metric is 16 pixels. This calculation allocates a reference extent; it does not assert that the letters being drawn actually reach 16 pixels above the text baseline.
The field used must be stated. OpenType provides
ascender in hhea and sTypoAscender in OS/2, while some older layout paths use other metrics. The sTypoAscender, sTypoDescender and sTypoLineGap fields are intended to work together for typographic line spacing. Their ascent-minus-descent need not equal unitsPerEm.[ref]OS/2 and Windows Metrics Table by Microsoft. sTypoAscender: default line spacing, legacy differences and independence from unitsPerEm
Combining a font ascent with the corresponding font descent and font line gap gives a consistent basis for choosing line height. Mixing fields chosen under different conventions can instead change the spacing even when the nominal font size is unchanged.
Font descent 2026-11-05
The font descent supplies the below-text baseline part of a font's vertical layout metrics. It must be distinguished from the descender of an individual glyph. The coordinate convention also matters: a downward extent can be represented as a negative coordinate in a system whose vertical axis points upward, or as a positive distance in another API.[ref]
Glyph Metrics in the FreeType documentation. Section2: descent sign in FreeType and other font formats
For example, a signed descent font units represents a downward extent font units. With 1000 font units per em and 20 pixels per em, its magnitude scales to 4 pixels. Calling that a negative height would confuse the coordinate with the distance being allocated.
Using a signed descent, an ascent and a font line gap in the same font units givesEquivalently, if is the positive downward extent, the same line height is . This is the elementary typographic spacing model; the rendering system's choice of metrics must still be respected.[ref]
Glyph Metrics in the FreeType documentation. Section2: linespace = ascent - descent + linegap
A computer font can contain several descent-related fields. For example, OpenType's
hhea header stores a typographic descender; an application must not infer the sign and purpose of every other API field merely from the word descent.[ref]Horizontal Header Table by Microsoft. descender and lineGap fields; remarks on platform-specific interpretations
Font line gap 2026-11-05
A font line gap is a font-wide metric giving an additional spacing allowance to combine with font ascent and font descent. For an elementary default line-spacing calculation using signed descent ,where is the ascent and the font line gap. OpenType's
sTypoLineGap is intended to be used with the matching sTypoAscender and sTypoDescender fields.[ref]OS/2 and Windows Metrics Table by Microsoft. sTypoLineGap and its relationship to the other typographic metrics
Suppose the chosen metrics are , and font units. The default spacing is 1100 font units. With 1000 font units per em at 18 pixels per em, that is 19.8 pixels between text baselines.
The stored font line gap provides an input to a spacing decision. An application can instead request a different line height, and CSS leading is then calculated from that requested height and the selected metrics. Nor does the font line gap measure the visible blank strip between every pair of lines: the ink bounding boxes vary with the particular glyphs. The line height diagram shows this distinction with schematic ink inside larger font-wide metric regions.
Font metric 2026-11-05
A font metric is a numerical measurement used to position text from a computer font. Measurements include glyph advances, glyph bearings, bounding boxes and face-level quantities such as font ascent, font descent and font line gap. These describe both logical movement and the geometry of the visible shapes.[ref]
For a horizontal example, put the pen position at , let a glyph have advance 12, and let its ink extend from to . Its ink width is , while the next pen position is . The negative left glyph bearing describes an overhang; it does not imply a negative glyph advance.
A separate example illustrates vertical conventions. With font ascent , signed descent and font line gap , the metric-based baseline separation isSome font formats store the descent magnitude with the opposite sign, so the convention must be checked before using the formula.[ref]
Glyph Metrics in the FreeType documentation. §2: ascent, signed descent and linespace formula
These measurements inform layout before rasterization determines the actual pixels. Line height 2026-11-05
The line height governs the vertical spacing allocated to a line of text. For a simple repeated run with fixed metrics, it sets the distance from one text baseline to the next. The gap between visible ink is a separate quantity, because different glyphs need not fill their allocated vertical region.
In an elementary single-font model, let be the positive font ascent, the positive magnitude of the font descent, and an added font line gap. ThenFor hypothetical metrics , and font units, font units. With 1000 font units per em and 20 pixels per em, the text baselines are 24 pixels apart. The line height can thus exceed the nominal font size.
CSS lays out inline content through line boxes. Its
line-height participates in that calculation, and a block's declared value sets a minimum rather than guaranteeing that every mixed-content line has exactly that height. A taller inline object or a different alignment can enlarge a line box. The specification also describes how extra typographic leading is split above and below the chosen font metrics.[ref]Visual formatting model details in CSS 2.2 by W3C. Sections10.8–10.8.1: line-box construction, leading and the block-container minimum
The useful distinction is between the nominal font size, the font ascent and font descent used for layout, and the actual ink bounding boxes. They answer different geometric questions even when they are expressed in the same units.

