Support0

CSS font-size-adjust playground

Explore font-size-adjust with controls for preserving perceived text size when changing font family and metric.

Ask AI

CSS font-size-adjust playground

Response generated with openai/gpt-5.4-nano. AI can make mistakes. Always review the result.

BaselineLab compares font-size-adjust with real text and changes of font family. Observe x-height, cap-height and character width with words such as minimum, fallback and readable. The property helps preserve the perceived text size when the font in use changes.

HTML
<p class="font-size-adjust-sample">
  BaselineLab compares font-size-adjust with real text and changes of font family.
  Observe x-height, cap-height and character width with words such as minimum, fallback and readable.
  The property helps preserve the perceived text size when the font in use changes.
</p>
Tailwind CSS
Examples for Tailwind CSS 4.3 with the default theme. Custom values keep arbitrary classes when there is no equivalent utility. Changing the theme can change utility values.
<p class="max-w-2xl [font-family:Verdana,_Geneva,_sans-serif] text-2xl font-semibold leading-normal [font-size-adjust:0.55]">
  BaselineLab compares font-size-adjust with real text and changes of font family.
  Observe x-height, cap-height and character width with words such as minimum, fallback and readable.
  The property helps preserve the perceived text size when the font in use changes.
</p>
CSS
.font-size-adjust-sample {
  max-inline-size: 40rem;
  font-family: Verdana, Geneva, sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.45;
  font-size-adjust: 0.55;
}

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.

  1. 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.

  2. Target: 0.5

    With ex-height, the target x-height is 10 px: 0.5 × 20 px.

  3. 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.

Static diagram with hypothetical ratiosThe formula is used size = (target ratio / font ratio) × nominal size. These figures illustrate the calculation; they are not measurements of installed fonts or a prediction of this preview.

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

All samples use 1.5rem. With support, the last two target an x-height of 0.75rem, although their design and width still differ. Generic families apply if Georgia or Verdana is missing; the visible difference depends on the fonts actually available.
Two families, with and without adjustment
<div class="font-adjust-guide-values">
  <div>
    <p class="label">Georgia / serif · none</p>
    <p class="sample serif">Trees, pages and small letters</p>
  </div>
  <div>
    <p class="label">Verdana / sans-serif · none</p>
    <p class="sample sans">Trees, pages and small letters</p>
  </div>
  <div>
    <p class="label">Georgia / serif · 0.5</p>
    <p class="sample serif adjusted">Trees, pages and small letters</p>
  </div>
  <div>
    <p class="label">Verdana / sans-serif · 0.5</p>
    <p class="sample sans adjusted">Trees, pages and small letters</p>
  </div>
</div>
.font-adjust-guide-values {
  display: grid;
  gap: 1.5rem;
  overflow-wrap: anywhere;

  .label {
    margin-block: 0 0.5rem;
    font-size: 1rem;
    line-height: 1.5;
  }

  .sample {
    margin: 0;
    font-size: 1.5rem;
    line-height: 1.8;
    font-size-adjust: none;
  }

  .serif {
    font-family: Georgia, serif;
  }

  .sans {
    font-family: Verdana, sans-serif;
  }

  .adjusted {
    font-size-adjust: 0.5;
  }
}

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

With support for each value, the samples target an x-height of 0.75rem, capital height of 1.05rem and zero advance of 0.75rem respectively. They are different targets, not three equivalent adjustments. Without that syntax, the sample keeps none and the text remains available.
Three targets on the same family
<div class="font-adjust-guide-metrics">
  <div>
    <p class="label">ex-height 0.5</p>
    <p class="sample lowercase">xxx HHH 000 · Trees, pages and small letters</p>
  </div>
  <div>
    <p class="label">cap-height 0.7</p>
    <p class="sample capitals">xxx HHH 000 · Trees, pages and small letters</p>
  </div>
  <div>
    <p class="label">ch-width 0.5</p>
    <p class="sample zero">xxx HHH 000 · Trees, pages and small letters</p>
  </div>
</div>
.font-adjust-guide-metrics {
  display: grid;
  gap: 1.5rem;
  overflow-wrap: anywhere;

  .label {
    margin-block: 0 0.5rem;
    font-size: 1rem;
    line-height: 1.5;
  }

  .sample {
    margin: 0;
    font-family: Georgia, serif;
    font-size: 1.5rem;
    line-height: 1.8;
    font-size-adjust: none;
  }

  @supports (font-size-adjust: ex-height 0.5) {
    .lowercase {
      font-size-adjust: ex-height 0.5;
    }
  }

  @supports (font-size-adjust: cap-height 0.7) {
    .capitals {
      font-size-adjust: cap-height 0.7;
    }
  }

  @supports (font-size-adjust: ch-width 0.5) {
    .zero {
      font-size-adjust: ch-width 0.5;
    }
  }
}

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

With support, the first text supplies the container’s x-height ratio. The second changes family and keeps the inherited target; the third obtains its own family’s ratio. Labels disable adjustment so they remain reading references.
Inherit the target or obtain it again
<div class="font-adjust-guide-reference">
  <div>
    <p class="label">Reference · Georgia / serif · from-font</p>
    <p class="sample">Trees, pages and small letters</p>
  </div>
  <div>
    <p class="label">Verdana / sans-serif · inherited ratio</p>
    <p class="sample fallback">Trees, pages and small letters</p>
  </div>
  <div>
    <p class="label">Verdana / sans-serif · from-font declared again</p>
    <p class="sample fallback recomputed">Trees, pages and small letters</p>
  </div>
</div>
.font-adjust-guide-reference {
  display: grid;
  gap: 1.5rem;
  font-family: Georgia, serif;
  font-size: 1.5rem;
  line-height: 1.8;
  overflow-wrap: anywhere;
  font-size-adjust: none;

  @supports (font-size-adjust: from-font) {
    font-size-adjust: from-font;
  }

  .label {
    margin-block: 0 0.5rem;
    font-family: system-ui, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    font-size-adjust: none;
  }

  .sample {
    margin: 0;
    font-size: inherit;
    line-height: inherit;
    font-size-adjust: inherit;
  }

  .fallback {
    font-family: Verdana, sans-serif;
  }

  @supports (font-size-adjust: from-font) {
    .recomputed {
      font-size-adjust: from-font;
    }
  }
}

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

FontSizeAdjustMissingDemo is neither defined nor downloaded. The browser uses Georgia or serif: the first row keeps the educational target of 0.5 and the second obtains the available fallback’s ratio. No download is simulated and 0.5 is not claimed to belong to the missing font.
A name without a font and two strategies
<div class="font-adjust-guide-fallback">
  <div>
    <p class="label">Explicit target · 0.5</p>
    <p class="sample fixed">Trees, pages and small letters</p>
  </div>
  <div>
    <p class="label">First available · from-font</p>
    <p class="sample automatic">Trees, pages and small letters</p>
  </div>
</div>
.font-adjust-guide-fallback {
  display: grid;
  gap: 1.5rem;
  overflow-wrap: anywhere;

  .label {
    margin-block: 0 0.5rem;
    font-size: 1rem;
    line-height: 1.5;
  }

  .sample {
    margin: 0;
    font-family: "FontSizeAdjustMissingDemo", Georgia, serif;
    font-size: 1.5rem;
    line-height: 1.8;
    font-size-adjust: none;
  }

  @supports (font-size-adjust: 0.5) {
    .fixed {
      font-size-adjust: 0.5;
    }
  }

  @supports (font-size-adjust: from-font) {
    .automatic {
      font-size-adjust: from-font;
    }
  }
}

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.