Educational guide to font-size-adjust
Preserve a metric when fonts change
Separate nominal size from apparent size. Compare ratios, metrics and from-font without promising identical layout across fonts.
Mental model
Two fonts at the same font-size can have lowercase letters of different heights. font-size-adjust scales each font used so a chosen metric matches the specified proportion of the nominal size. It can also affect the first font, not only fallbacks.
- Nominal size: 20 px
This is the computed font-size. It does not mean that an x or a capital letter is 20 px tall.
- Target: 0.5
With ex-height, the target x-height is 10 px: 0.5 × 20 px.
- Font with a ratio of 0.4
It is used at 25 px: (0.5 / 0.4) × 20. Its x reaches 10 px, but the computed font-size remains 20 px.
none and a unitless number
none keeps each font at its normal scale. 0.5 requests an x-height of half the font-size; it is equivalent to ex-height 0.5. It does not mean increasing text by 50% or multiplying every font by 0.5.
Two families, with and without adjustment
Georgia / serif · none
Trees, pages and small letters
Verdana / sans-serif · none
Trees, pages and small letters
Georgia / serif · 0.5
Trees, pages and small letters
Verdana / sans-serif · 0.5
Trees, pages and small letters
The number accepts zero and positive values; negatives and percentages are invalid. Zero can make glyphs disappear: do not use it to hide content. To keep the first font unscaled, use its actual ratio or from-font; 0.5 here is an educational target, not a universal calibration.
Choose the metric to preserve
ex-height uses x-height; cap-height, capital height; ch-width, the horizontal advance of zero. The number is always a proportion of font-size. Adjusting one metric scales the whole font, not just the reference letter.
Three targets on the same family
ex-height 0.5
xxx HHH 000 · Trees, pages and small letters
cap-height 0.7
xxx HHH 000 · Trees, pages and small letters
ch-width 0.5
xxx HHH 000 · Trees, pages and small letters
ic-width uses the horizontal advance of 水 and ic-height its vertical advance; they address ideographic character pitch, not identical ink bounds. Test the actual script, faces and glyphs: a missing metric may require a browser approximation. Do not extrapolate the Latin example to every script.
from-font and the inherited reference
from-font obtains the ratio from the first available font when computing the value; without a usable metric it behaves as none. The property is inherited: a descendant can keep that ratio even when its family changes. Declaring from-font again takes a reference in the new context.
Inherit the target or obtain it again
Reference · Georgia / serif · from-font
Trees, pages and small letters
Verdana / sans-serif · inherited ratio
Trees, pages and small letters
Verdana / sans-serif · from-font declared again
Trees, pages and small letters
Changing font-family and declaring from-font on each sample does not by itself keep the previous target. In text using several fonts, from-font can harmonize fonts used for other glyphs against the first available font. Metrics can also vary between faces of the same family.
When the preferred font is missing
If the first family is unavailable, from-font cannot know its missing metrics: it uses the first available font. A numeric ratio measured from the preferred font keeps that target even before it loads or if it never becomes available.
A name without a font and two strategies
Explicit target · 0.5
Trees, pages and small letters
First available · from-font
Trees, pages and small letters
In production, replace that name with your family and the number with a measurement of the face used. Test normal loading, blocked loading and font changes. @supports evaluates each declaration; it does not prove that a family is installed or that its glyphs or metrics match expectations.
Visual stability and adjustment limits
Matching x-height can stabilize apparent text size, but does not equalize widths, kerning, ascenders or line breaks. It does not guarantee eliminating CLS or keeping the same number of lines while a font loads.
Computed font-size and em do not change; metric-based units such as ex or ch can change. A numeric line-height still uses the computed size, so adjustment may bring ink on adjacent lines closer together. Keep sufficient line spacing and boxes that can grow; test accents, fallback and text resizing.
size-adjust is an @font-face descriptor, expressed as a percentage and applied to a face, whereas font-size-adjust is an inherited property applied to text. ascent-override, descent-override and line-gap-override adjust other line metrics. They are not interchangeable: font-size-adjust applies after size-adjust and can neutralize its scaling. Calibrate the whole strategy; text-box addresses block edges separately.
Common mistakes
Adjustment changes nothing
- Expected result
- The chosen target applies.
- Cause
- The value is 50%, which is invalid for this property, or the browser does not support that syntax.
- Solution
- Use a unitless ratio such as 0.5 and check the exact declaration. To change the design’s text size, change font-size.
Fallback does not preserve the missing font
- Expected result
- The target metric remains that of the preferred font.
- Cause
- from-font takes the first available font; it cannot retrieve data from a font that failed to load.
- Solution
- Measure the preferred face’s ratio and declare that number if you need to keep it without the font. Check line breaks too.
Accents and descenders overlap
- Expected result
- Lines remain readable with any fallback.
- Cause
- The font used has grown, but tight line spacing is still based on nominal size.
- Solution
- Increase line-height, allow automatic height and test text at 200% and reflow at 320 CSS pixels without clipping ink or content.
Support by syntax and value
Web Platform DX lists font-size-adjust as Baseline Newly Available since July 25, 2024 when checked for this guide. That label does not replace checking the exact syntax and the device’s fonts.
MDN BCD distinguishes none/numbers, from-font and two-value syntax. For basic forms it records Chrome 127, Firefox 3 and Safari 16.4; for from-font, Chrome 127, Firefox 118 and Safari 17; for two values, Chrome 127, Firefox 92 and Safari 17. Its record groups two-value metrics: separately check ex-height, cap-height, ch-width, ic-width or ic-height with the combination you intend to use.
Scenes use native CSS without JavaScript emulation. Without support they remain readable with no metric normalization. CSS.supports or @supports only confirm syntax acceptance; they do not certify font selection, optical equality or accessibility. Check actual appearance, font changes and user preferences too.