CSS font-size-adjust Property
The font-size-adjust property adjusts a font's rendered size to preserve a specified font metric, helping text remain readable when different fonts are used.
Two fonts with the same font-size can appear noticeably different because their lowercase letters, capital letters, and other glyph measurements have different proportions. The font-size-adjust property compensates for these differences, making it especially useful when a preferred web font is replaced by a fallback font.
font-size-adjust Syntax
The font-size-adjust property accepts none, a non-negative number, from-font, or an optional font metric followed by a number or from-font.
Basic Syntax
selector {
font-size-adjust: 0.5;
}
Disable Adjustment
selector {
font-size-adjust: none;
}
Use the Font's Own Metric
selector {
font-size-adjust: from-font;
}
Specify a Font Metric
selector {
font-size-adjust: cap-height 0.7;
}
Use a Metric from the Font
selector {
font-size-adjust: cap-height from-font;
}
CSS-Wide Keywords
.example {
font-size-adjust: inherit;
}
.example {
font-size-adjust: initial;
}
.example {
font-size-adjust: unset;
}
.example {
font-size-adjust: revert;
}
.example {
font-size-adjust: revert-layer;
}
When a metric is omitted, the property uses ex-height. Numeric values represent metric ratios, not pixel measurements or percentages.
Property Values
The available values determine which font measurement is preserved and how the adjustment ratio is selected.
| Value | Description |
|---|---|
none |
Disables font-size adjustment. |
<number> |
Uses a specified aspect ratio based on x-height. |
from-font |
Obtains the aspect ratio from the first available font. |
ex-height |
Uses the font's x-height. |
cap-height |
Uses the height of capital letters. |
ch-width |
Uses the advance width of the 0 glyph. |
ic-width |
Uses the advance width of the full-width ideographic glyph. |
ic-height |
Uses the advance height of the full-width ideographic glyph. |
Property Characteristics
| Characteristic | Value |
|---|---|
| Initial value | none |
| Inherited | Yes |
| Applies to | All elements and text |
| Computed value | As specified |
| Animation type | By computed value type |
| Percentages | Not applicable |
The extended metric syntax is defined in CSS Fonts Level 5. Older implementations may support only none and numeric x-height adjustments.
How It Works
Fonts have different internal proportions. For example, one font may have relatively tall lowercase letters, while another has smaller lowercase letters at the same nominal font size.
The Aspect Ratio
For x-height adjustment, the aspect ratio is calculated as:
aspect ratio = x-height / font size
A font with an x-height of 8px at a font size of 16px has an aspect ratio of 0.5.
The Adjustment Formula
The browser adjusts the font size using the requested ratio and the selected font's actual metric ratio.
adjusted font size = specified font size × (requested ratio / actual ratio)
Calculation Example
Suppose the specified font size is 20px, the requested ratio is 0.5, and the selected font's actual ratio is 0.4.
20px × (0.5 / 0.4) = 25px
The font is rendered using an adjusted size of 25px to achieve the requested x-height relationship.
Important Consideration
This adjustment changes the font's rendered glyph dimensions. It does not change the computed value of the font-size property or guarantee identical character widths, line breaks, or overall appearance.
The none Value
The none value disables font-size adjustment and is the property's initial value.
Default Behavior
p {
font-size-adjust: none;
}
Using Different Fonts
.heading-one {
font-family: Georgia, serif;
font-size: 24px;
font-size-adjust: none;
}
.heading-two {
font-family: Arial, sans-serif;
font-size: 24px;
font-size-adjust: none;
}
Both headings use the same specified font size, but their visible letter proportions may differ.
Reset an Inherited Adjustment
.container {
font-size-adjust: 0.5;
}
.container .unadjusted {
font-size-adjust: none;
}
The child element disables the inherited adjustment.
Numeric Values
A numeric value specifies the target ratio for the selected font metric. Without an explicit metric keyword, the number refers to x-height.
Basic Numeric Value
p {
font-size-adjust: 0.5;
}
Different Ratios
.text-small-ratio {
font-size-adjust: 0.4;
}
.text-medium-ratio {
font-size-adjust: 0.5;
}
.text-large-ratio {
font-size-adjust: 0.6;
}
These values request different metric ratios. The visual effect depends on the font's original proportions.
Explicit x-Height Metric
p {
font-size-adjust: ex-height 0.5;
}
This is equivalent in meaning to specifying 0.5 without a metric keyword.
Invalid Negative Value
p {
font-size-adjust: -0.5;
}
Negative values are invalid. A value of 0 is permitted, although it is generally not useful for readable text.
Important Consideration
The ideal ratio depends on the font and the metric being preserved. Avoid assuming that one numeric value is suitable for every font family.
The from-font Value
The from-font value allows the browser to obtain the target aspect ratio from the first available font in the font-family list.
Basic Example
.article-text {
font-family: "Example Web Font", Arial, sans-serif;
font-size-adjust: from-font;
}
The browser uses the selected metric from the first available font as the reference for adjusting other fonts used to render the text.
Specify Cap Height
.heading {
font-family: "Example Heading Font", Georgia, serif;
font-size-adjust: cap-height from-font;
}
Specify Character Width
.code-text {
font-family: "Example Code Font", monospace;
font-size-adjust: ch-width from-font;
}
Why Use from-font?
It avoids manually determining a metric ratio when the font provides the necessary information.
Important Consideration
If the preferred font is unavailable, the reference metric may come from a fallback font. The value does not guarantee that a missing web font and its replacement will have identical proportions.
Font Metrics
The extended syntax supports several font measurements, allowing adjustments to target different aspects of glyph size.
Available Metrics
| Metric | Measurement | Typical Use |
|---|---|---|
ex-height |
Lowercase x-height | Maintaining lowercase text proportions. |
cap-height |
Capital-letter height | Matching uppercase headings. |
ch-width |
Advance width of the 0 glyph |
Adjusting character-width proportions. |
ic-width |
Ideographic advance width | Matching ideographic character widths. |
ic-height |
Ideographic advance height | Matching ideographic character heights. |
Examples
.body-text {
font-size-adjust: ex-height 0.52;
}
.heading {
font-size-adjust: cap-height 0.7;
}
.code-text {
font-size-adjust: ch-width 0.55;
}
.ideographic-text {
font-size-adjust: ic-width 1;
}
Important Consideration
These measurements describe different aspects of a font. A value suitable for x-height is not necessarily appropriate for cap height or character width.
Adjusting x-Height
The x-height is the height of lowercase letters such as x, excluding ascenders and descenders.
Example
.body-text {
font-family: Verdana, Arial, sans-serif;
font-size: 18px;
font-size-adjust: 0.55;
}
The browser adjusts the rendered font size to produce the requested x-height ratio.
Explicit Metric Syntax
.body-text {
font-size-adjust: ex-height 0.55;
}
Why x-Height Matters
Lowercase letters make up much of ordinary body text. Fonts with a relatively small x-height can appear smaller than fonts with a larger x-height, even when their nominal font sizes match.
Important Consideration
Matching x-height improves consistency in lowercase letter proportions but does not make different fonts visually identical.
Adjusting Cap Height
The cap-height metric adjusts the rendered font size according to the height of capital letters.
Example
.uppercase-heading {
font-family: Georgia, serif;
font-size: 36px;
font-size-adjust: cap-height 0.7;
text-transform: uppercase;
}
Use a Font-Derived Ratio
.uppercase-heading {
font-size-adjust: cap-height from-font;
}
When to Use Cap Height
Cap-height adjustment can be useful for headings, labels, and interface elements that rely heavily on uppercase letters.
Important Consideration
The cap-height metric is part of the extended syntax. Check compatibility before relying on it in layouts that require consistent rendering across browsers.
Fallback Fonts
One of the main uses of font-size-adjust is reducing visible size differences when a preferred font is unavailable.
Without Adjustment
.article-text {
font-family: "Example Web Font", Georgia, serif;
font-size: 18px;
font-size-adjust: none;
}
If the preferred font fails to load, Georgia may appear larger or smaller because its internal proportions differ.
With Adjustment
.article-text {
font-family: "Example Web Font", Georgia, serif;
font-size: 18px;
font-size-adjust: 0.52;
}
The browser adjusts the selected font's rendered size to match the requested x-height ratio.
Using from-font
.article-text {
font-family: "Example Web Font", Georgia, serif;
font-size-adjust: from-font;
}
The browser obtains the reference ratio from the first available font rather than using a manually supplied number.
Web Font Loading
Font-size adjustment can reduce changes in apparent text size while fonts load. However, differences in character widths, spacing, and line wrapping may still cause layout changes.
Important Consideration
For additional control over fallback font metrics, the @font-face rule provides descriptors such as size-adjust, ascent-override, descent-override, and line-gap-override. These descriptors serve different purposes from the inherited font-size-adjust property.
font-size vs. font-size-adjust
The font-size and font-size-adjust properties work together but control different aspects of font rendering.
Using font-size
p {
font-size: 20px;
}
This sets the font's specified size.
Using font-size-adjust
p {
font-size: 20px;
font-size-adjust: 0.5;
}
This preserves the specified font size while allowing the browser to adjust the font's rendered glyph size according to the requested metric ratio.
Comparison
| Property | Purpose |
|---|---|
font-size |
Specifies the nominal font size. |
font-size-adjust |
Adjusts rendered font dimensions to preserve a selected metric ratio. |
Important Consideration
Changing font-size-adjust does not change the computed font-size value, even when the rendered glyphs become larger or smaller.
Inheritance
The font-size-adjust property is inherited, allowing child elements to use the same adjustment settings unless they override them.
Set Adjustment on a Container
.article {
font-size-adjust: 0.52;
}
Override a Child Element
.article {
font-size-adjust: 0.52;
}
.article .heading {
font-size-adjust: cap-height 0.7;
}
Disable Adjustment for a Child
.article .unadjusted {
font-size-adjust: none;
}
Explicit Inheritance
.child {
font-size-adjust: inherit;
}
Important Consideration
Different font families may require different target ratios. Applying one adjustment to an entire page can produce unexpected results when headings, body text, and interface elements use different fonts.
font-size-adjust Example
This example compares two font families using the same nominal font size, first without adjustment and then with an x-height adjustment.
The adjusted examples use font-size-adjust: 0.55. The visible difference depends on the fonts available in the browser and their actual x-height ratios.
HTML Example
<div class="font-adjust-demo">
<p class="demo-label">Georgia - no adjustment</p>
<p class="georgia-normal">Readable Typography</p>
<p class="demo-label">Georgia - adjusted</p>
<p class="georgia-adjusted">Readable Typography</p>
<p class="demo-label">Arial - no adjustment</p>
<p class="arial-normal">Readable Typography</p>
<p class="demo-label">Arial - adjusted</p>
<p class="arial-adjusted">Readable Typography</p>
</div>
CSS Example
.font-adjust-demo {
font-size: 24px;
}
.font-adjust-demo p {
margin: 0 0 14px;
line-height: 1.4;
}
.font-adjust-demo .demo-label {
font: 600 13px/1.4 Arial, sans-serif;
}
.georgia-normal {
font-family: Georgia, serif;
font-size-adjust: none;
}
.georgia-adjusted {
font-family: Georgia, serif;
font-size-adjust: 0.55;
}
.arial-normal {
font-family: Arial, sans-serif;
font-size-adjust: none;
}
.arial-adjusted {
font-family: Arial, sans-serif;
font-size-adjust: 0.55;
}
Georgia - no adjustment
Readable Typography
Georgia - adjusted
Readable Typography
Arial - no adjustment
Readable Typography
Arial - adjusted
Readable Typography
The unadjusted examples display each font at its normal proportions. The adjusted examples request an x-height ratio of 0.55, which may increase or decrease the rendered glyph size depending on the selected font.
The adjustment is intended to improve consistency in the selected metric. It does not make Georgia and Arial identical in letter shapes, spacing, or overall appearance.
Common Mistakes
Most problems occur when numeric ratios are confused with font sizes or when the property is expected to make different fonts visually identical.
Using a Length Value
p {
font-size-adjust: 16px;
}
This declaration is invalid. The property expects a ratio, a supported keyword, or a metric followed by an appropriate value.
Using a Percentage
p {
font-size-adjust: 50%;
}
Percentages are not valid values for this property.
Using a Negative Ratio
p {
font-size-adjust: -0.5;
}
Negative ratios are invalid.
Confusing font-size with font-size-adjust
The font-size property sets the nominal size. The font-size-adjust property adjusts rendering according to a font metric.
Using the Same Ratio for Every Font
Different font families have different proportions. A ratio that works well for one font may produce undesirable results with another.
Assuming All Font Dimensions Match
Matching x-height or cap height does not guarantee identical character widths, line breaks, or overall font appearance.
Ignoring Browser Compatibility
The extended syntax, including cap-height, ch-width, and from-font, may not be available in older browser versions.
Confusing font-size-adjust with @font-face size-adjust
The size-adjust descriptor inside @font-face scales a specific font face. The font-size-adjust property uses font metrics to adjust rendering for text.
Important Considerations
Keep the following points in mind when using the font-size-adjust property:
- Purpose: Preserves a selected font metric ratio when rendering text.
- Initial value:
none. - Inheritance: The property is inherited.
- Applies to: All elements and text.
- none: Disables font-size adjustment.
- Numeric values: Specify non-negative metric ratios.
- Default metric:
ex-height. - from-font: Obtains the target ratio from the first available font.
- ex-height: Preserves lowercase x-height proportions.
- cap-height: Preserves capital-letter height proportions.
- ch-width: Uses the advance width of the
0glyph. - ic-width: Uses an ideographic advance-width metric.
- ic-height: Uses an ideographic advance-height metric.
- Fallback fonts: Adjustment can reduce apparent text-size differences.
- Font loading: It may help reduce visual changes when fallback fonts are displayed.
- Computed font-size: The property does not change the computed
font-sizevalue. - Font proportions: Different fonts can still have different character widths and spacing.
- Invalid values: Negative numbers, percentages, and length units are not accepted.
- Extended syntax: Metric keywords and
from-fontare defined in CSS Fonts Level 5. - Compatibility: Basic numeric adjustment and extended metric syntax may have different browser support.
- Accessibility: Adjustment can improve consistency but does not replace appropriate font sizes, line heights, and contrast.
Use font-size-adjust when differences between font metrics affect readability or visual consistency. Choose the metric and target ratio based on the fonts used rather than applying an arbitrary value throughout the website.
Browser Support
The CSS font-size-adjust property is Widely available in modern browsers, including Chrome, Edge, Firefox, and Safari.
Support for numeric x-height adjustment is established in current browser versions. The extended syntax with additional font metrics and from-font is newer and may require more recent browser versions.
Basic Supported Example
p {
font-size-adjust: 0.5;
}
Extended Syntax Example
h1 {
font-size-adjust: cap-height from-font;
}
Fallback Example
h1 {
font-size-adjust: 0.7;
font-size-adjust: cap-height 0.7;
}
Browsers that do not recognize the extended metric syntax can retain the earlier numeric declaration.
Feature Detection
@supports (font-size-adjust: cap-height from-font) {
h1 {
font-size-adjust: cap-height from-font;
}
}
For current compatibility information, visit Can I Use? and search for font-size-adjust.
Specifications
The font-size-adjust property is defined in the CSS Fonts Module. CSS Fonts Level 5 extends the property to support additional font metrics and font-derived adjustment ratios.
CSS Fonts Module Level 5: font-size-adjust Property
Earlier definitions of the property are available in CSS Fonts Level 3.
CSS Fonts Module Level 3: font-size-adjust Property
For additional explanations and examples, see MDN Web Docs.
