Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

font-size-adjust — normalizing font metrics

The font-size-adjust property scales the font in use according to a selected metric, such as x-height. It helps preserve a similar apparent text size with fallback fonts without changing the computed font-size.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

font-size-adjust: none | [ ex-height | cap-height | ch-width | ic-width | ic-height ]? [ from-font | <number [0,∞]> ];

font-size-adjust normalizes a selected metric relative to font-size, including for fallback fonts. It is inherited; the initial none disables adjustment. A number is a target metric-to-size ratio, not a multiplier: 0.5 at 32px targets a 16px x-height. Negative values and percentages are invalid.

The default ex-height means x-height; cap-height means capital height; ch-width means the advance width of 0; ic-width and ic-height mean the advance width and height of 水, respectively. from-font obtains the ratio from the first available font; if it cannot be obtained, it acts like none.

Adjustment changes used, not computed, font-size: it does not scale em units or the line height established by numeric line-height, but can affect ex and ch. Overly tight lines can overlap. This is not the @font-face descriptor size-adjust, which specifies a percentage multiplier.

The example compares unadjusted text with text adjusted to a target ratio of 0.5; appearance depends on the installed font. The example ran in Chromium 157, and its console output exactly matched the expected output. This run does not establish support in Chromium 152. See CSS Fonts Module Level 5 for the property definition.

Examples

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Adjusting font size by x-height</title>
  <style>
    .sample { font-family: sans-serif; font-size: 32px; line-height: 1.8; }
    #baseline { font-size-adjust: none; }
    #adjusted { font-size-adjust: 0.5; }
  </style>
</head>
<body>
  <p class="sample" id="baseline">xxxx Example 0123</p>
  <p class="sample" id="adjusted">xxxx Example 0123</p>
  <p>The second sample targets an x-height of half the font size. Any visible difference depends on the chosen font's x-height.</p>
  <script>
    for (const id of ['baseline', 'adjusted']) {
      const style = getComputedStyle(document.getElementById(id));
      console.log(`${id}: font-size-adjust=${style.fontSizeAdjust}, font-size=${style.fontSize}`);
    }
  </script>
</body>
</html>

Result

baseline: font-size-adjust=none, font-size=32px
adjusted: font-size-adjust=0.5, font-size=32px

The code ran in isolated Chromium 157.0.8103.51 with external requests blocked. The console output exactly matched the output shown.

Sources