CSS font-stretch Property
The font-stretch property selects a condensed, normal, or expanded font face from the available widths in a font family.
Font families may include several width variations designed to make characters narrower or wider without simply scaling their outlines. The font-stretch property selects these variations using descriptive keywords or percentages. With compatible variable fonts, it can also select intermediate widths along the font's width axis.
font-stretch Syntax
The font-stretch property accepts a width keyword, a non-negative percentage, or a CSS-wide keyword.
Basic Syntax
selector {
font-stretch: condensed;
}
Expanded Font
selector {
font-stretch: expanded;
}
Normal Width
selector {
font-stretch: normal;
}
Percentage Value
selector {
font-stretch: 75%;
}
Variable Font Width
selector {
font-stretch: 112.5%;
}
CSS-Wide Keywords
.example {
font-stretch: inherit;
}
.example {
font-stretch: initial;
}
.example {
font-stretch: unset;
}
.example {
font-stretch: revert;
}
.example {
font-stretch: revert-layer;
}
Percentage values below 100% request narrower font widths, while values above 100% request wider font widths. The selected font must provide compatible width variations for the requested value to produce a visible difference.
Property Values
The property provides nine named width categories and supports percentage values for more precise font selection.
Keyword Values
| Value | Equivalent Percentage | Description |
|---|---|---|
ultra-condensed |
50% | Requests the narrowest standard width category. |
extra-condensed |
62.5% | Requests a very narrow font face. |
condensed |
75% | Requests a condensed font face. |
semi-condensed |
87.5% | Requests a slightly condensed font face. |
normal |
100% | Requests the normal font width. |
semi-expanded |
112.5% | Requests a slightly expanded font face. |
expanded |
125% | Requests an expanded font face. |
extra-expanded |
150% | Requests a very wide font face. |
ultra-expanded |
200% | Requests the widest standard width category. |
These percentages identify standard width categories. They do not mean the browser horizontally stretches ordinary glyphs by those amounts.
Property Characteristics
| Characteristic | Value |
|---|---|
| Initial value | normal |
| Inherited | Yes |
| Applies to | All elements and text |
| Computed value | A percentage |
| Animation type | By computed value type |
| Percentages | Specify the requested font width |
Keywords compute to their corresponding percentages. The actual rendered width depends on the available font faces and the browser's font matching process.
How It Works
The font-stretch property participates in font selection. It tells the browser which width variation to use when matching the requested font family, style, and weight.
Font Width Variations
Some font families provide separate condensed, normal, and expanded designs. These faces can have different character proportions, spacing, and outline details.
Selecting a Width
.heading {
font-family: "Example Sans", sans-serif;
font-stretch: condensed;
}
The browser searches for a suitable condensed face within the selected font family.
Variable Font Selection
When a variable font includes a registered width axis, the browser can select a width from the supported range.
.heading {
font-family: "Example Variable Sans", sans-serif;
font-stretch: 85%;
}
Missing Width Variations
If the font family does not contain the requested width, the browser selects the closest available match according to CSS font matching rules.
Important Consideration
The property does not automatically compress or expand every font. A font family with only a normal-width face may show no visible change.
Keyword Values
Keyword values provide a readable way to request standard font width categories.
Condensed Categories
.ultra-condensed {
font-stretch: ultra-condensed;
}
.extra-condensed {
font-stretch: extra-condensed;
}
.condensed {
font-stretch: condensed;
}
.semi-condensed {
font-stretch: semi-condensed;
}
Normal Width
.normal {
font-stretch: normal;
}
Expanded Categories
.semi-expanded {
font-stretch: semi-expanded;
}
.expanded {
font-stretch: expanded;
}
.extra-expanded {
font-stretch: extra-expanded;
}
.ultra-expanded {
font-stretch: ultra-expanded;
}
Choosing a Keyword
Use descriptive keywords when a standard width category is sufficient. For example, semi-condensed can be useful for compact headings, while expanded may suit display typography.
Important Consideration
The browser selects from the widths supplied by the font family. A keyword does not guarantee that a matching font face exists.
Percentage Values
Percentage values allow font widths to be specified more precisely than the named categories.
Narrower Width
.compact-heading {
font-stretch: 80%;
}
Normal Width
.normal-heading {
font-stretch: 100%;
}
Wider Width
.wide-heading {
font-stretch: 120%;
}
Fractional Percentage
.custom-heading {
font-stretch: 92.5%;
}
Percentage Categories
| Percentage | Requested Width |
|---|---|
| Less than 100% | Condensed |
| 100% | Normal |
| Greater than 100% | Expanded |
Important Consideration
Percentages are width selection values, not percentages of the parent element's font size or container width. The available font determines which widths can actually be rendered.
Condensed Fonts
Condensed fonts have narrower character proportions than their normal-width counterparts. They can help fit headings and labels into limited horizontal space.
Condensed Heading
.heading {
font-family: "Example Sans Condensed", sans-serif;
font-stretch: condensed;
}
Semi-Condensed Heading
.heading {
font-family: "Example Variable Sans", sans-serif;
font-stretch: semi-condensed;
}
Percentage Alternative
.heading {
font-stretch: 75%;
}
Typical Uses
- Navigation labels with limited horizontal space.
- Large headings that need a compact appearance.
- Interface labels and dashboard headings.
- Display typography using a condensed font design.
Important Consideration
Excessively condensed text can reduce readability. Choose widths that remain comfortable to read, especially for paragraphs and smaller text.
Expanded Fonts
Expanded fonts have wider character proportions and are often used for display typography or headings that need a broad visual appearance.
Expanded Heading
.heading {
font-family: "Example Variable Sans", sans-serif;
font-stretch: expanded;
}
Semi-Expanded Heading
.heading {
font-stretch: semi-expanded;
}
Percentage Alternative
.heading {
font-stretch: 125%;
}
Typical Uses
- Large page titles and display headings.
- Branding and decorative typography.
- Short labels intended to have a wider appearance.
- Variable font designs with an expanded width axis.
Important Consideration
Expanded fonts require more horizontal space and may cause text to wrap sooner. Test them at narrow viewport widths.
Font Matching and Fallbacks
When the requested width is unavailable, the browser uses font matching rules to select an available face.
Requested Width
.heading {
font-family: "Example Sans", Arial, sans-serif;
font-stretch: condensed;
}
The browser attempts to find a suitable condensed face in the selected font family.
Unavailable Width
If the family contains only a normal-width face, the browser may use that face rather than producing a condensed appearance.
Width Matching Order
CSS defines how available widths are searched when an exact match is missing.
- For requests at or below
100%, narrower available widths are preferred before wider ones. - For requests above
100%, wider available widths are preferred before narrower ones. - The browser uses the closest matching available face according to the defined search order.
Fallback Font Families
.heading {
font-family: "Example Variable Sans", Arial, sans-serif;
font-stretch: 85%;
}
If the preferred family is unavailable, a fallback font may be selected. The fallback may not offer the same width range.
Important Consideration
Font width matching is not the same as applying transform: scaleX(). The browser selects font designs or variable font instances rather than automatically distorting glyphs.
Variable Fonts
Variable fonts can contain a continuous range of width variations within a single font file.
The wdth Axis
The registered wdth axis controls the width of glyphs in compatible variable fonts. The font-stretch property provides a higher-level way to select that axis.
Example
.variable-heading {
font-family: "Example Variable Sans", sans-serif;
font-stretch: 85%;
}
Using font-variation-settings
.variable-heading {
font-family: "Example Variable Sans", sans-serif;
font-variation-settings: "wdth" 85;
}
The font-variation-settings property directly sets the registered width axis. For ordinary width selection, font-stretch is generally preferable because it participates in the standard font matching system.
Variable Width Range
.narrow {
font-stretch: 75%;
}
.normal {
font-stretch: 100%;
}
.wide {
font-stretch: 125%;
}
Important Consideration
A variable font must provide a width axis that supports the requested range. Direct font-variation-settings declarations can also override higher-level width settings for the same axis.
Using @font-face
The font-stretch descriptor inside @font-face identifies the width or width range supplied by a font resource.
Separate Condensed Font File
@font-face {
font-family: "Example Sans";
src: url("example-sans-condensed.woff2") format("woff2");
font-stretch: condensed;
font-style: normal;
font-weight: 400;
}
Normal Font File
@font-face {
font-family: "Example Sans";
src: url("example-sans-regular.woff2") format("woff2");
font-stretch: normal;
font-style: normal;
font-weight: 400;
}
Selecting the Condensed Face
.heading {
font-family: "Example Sans", sans-serif;
font-stretch: condensed;
}
Variable Font Width Range
@font-face {
font-family: "Example Variable Sans";
src: url("example-variable-sans.woff2") format("woff2");
font-stretch: 75% 125%;
font-style: normal;
font-weight: 100 900;
}
The range declares that the font resource supports width values from 75% through 125%.
Using the Variable Font
.heading {
font-family: "Example Variable Sans", sans-serif;
font-stretch: 110%;
}
Important Consideration
The font-stretch descriptor describes the capabilities of the font resource. It does not create additional widths that the font file does not contain.
font-stretch vs. transform
The font-stretch property selects font width variations, while transform: scaleX() scales the rendered element horizontally.
Using font-stretch
.heading {
font-stretch: condensed;
}
This requests a condensed font design when one is available.
Using transform
.heading {
transform: scaleX(0.75);
}
This scales the rendered element to 75% of its original horizontal size. It can distort glyph shapes and does not change the space reserved during normal layout.
Comparison
| Feature | font-stretch | transform: scaleX() |
|---|---|---|
| Method | Selects a font width. | Scales rendered content. |
| Requires width variations | Yes, for a visible change. | No. |
| Glyph design | Uses available font outlines. | Distorts existing outlines. |
| Text layout | Uses the selected font's metrics. | Does not recalculate normal layout space. |
Important Consideration
Use font-stretch when the font provides suitable width variations. Avoid using horizontal transforms as a substitute for a properly designed condensed or expanded font.
Inheritance
The font-stretch property is inherited. Child elements use their parent's computed width selection unless they specify another value.
Inherited Width
.container {
font-stretch: condensed;
}
<div class="container">
<p>This paragraph inherits the condensed width request.</p>
</div>
Override a Child
.container {
font-stretch: condensed;
}
.container .normal-text {
font-stretch: normal;
}
Explicit Inheritance
.child {
font-stretch: inherit;
}
Reset to the Initial Value
.child {
font-stretch: initial;
}
The initial value is normal, equivalent to 100%.
Important Consideration
Inherited width requests may affect descendant text using different font families. If a child font lacks the requested width, the visible result may differ.
font-stretch Example
This example uses the variable font Roboto Flex, which supports a width axis. It compares condensed, normal, and expanded width settings.
The example loads a variable font from Google Fonts. An internet connection is required for the intended demonstration. If the font cannot load, the fallback font may not respond to font-stretch.
HTML Example
<div class="font-stretch-demo">
<p class="demo-label">75% - condensed</p>
<p class="stretch-condensed">Responsive Typography</p>
<p class="demo-label">87.5% - semi-condensed</p>
<p class="stretch-semi-condensed">Responsive Typography</p>
<p class="demo-label">100% - normal</p>
<p class="stretch-normal">Responsive Typography</p>
<p class="demo-label">112.5% - semi-expanded</p>
<p class="stretch-semi-expanded">Responsive Typography</p>
<p class="demo-label">125% - expanded</p>
<p class="stretch-expanded">Responsive Typography</p>
</div>
CSS Example
@import url("https://fonts.googleapis.com/css2?family=Roboto+Flex:wdth,wght@75..125,400&display=swap");
.font-stretch-demo {
font-family: "Roboto Flex", Arial, sans-serif;
}
.font-stretch-demo p {
margin: 0 0 14px;
}
.font-stretch-demo .demo-label {
font: 600 13px/1.4 Arial, sans-serif;
}
.font-stretch-demo .stretch-condensed,
.font-stretch-demo .stretch-semi-condensed,
.font-stretch-demo .stretch-normal,
.font-stretch-demo .stretch-semi-expanded,
.font-stretch-demo .stretch-expanded {
font-size: 25px;
font-weight: 400;
line-height: 1.4;
}
.stretch-condensed {
font-stretch: 75%;
}
.stretch-semi-condensed {
font-stretch: 87.5%;
}
.stretch-normal {
font-stretch: 100%;
}
.stretch-semi-expanded {
font-stretch: 112.5%;
}
.stretch-expanded {
font-stretch: 125%;
}
75% - condensed
Responsive Typography
87.5% - semi-condensed
Responsive Typography
100% - normal
Responsive Typography
112.5% - semi-expanded
125% - expanded
When the variable font loads successfully, the text becomes progressively wider as the font-stretch percentage increases.
The browser uses the font's available width designs rather than simply applying a horizontal transform. The actual character proportions are determined by the font's width axis.
Common Mistakes
Most problems with font-stretch occur when the selected font does not provide the requested width variations.
Expecting Every Font to Stretch
p {
font-family: Arial, sans-serif;
font-stretch: expanded;
}
This may produce no visible difference because the selected font family may not provide an expanded face.
Using a Length Value
p {
font-stretch: 20px;
}
This declaration is invalid. Use a supported keyword or percentage.
Using a Negative Percentage
p {
font-stretch: -25%;
}
Negative percentages are invalid.
Confusing Font Width with Font Size
The font-stretch property selects character width variations. The font-size property controls the font's nominal size.
Confusing Font Width with Letter Spacing
The letter-spacing property changes the space between characters. It does not select narrower or wider glyph designs.
Using transform Instead of a Width Variation
.heading {
transform: scaleX(0.75);
}
This distorts the rendered element and does not select a condensed font face.
Ignoring the Variable Font Range
Requesting 150% does not guarantee that a variable font supports that width. The font may provide only a narrower range.
Overriding the Width Axis
.heading {
font-stretch: 75%;
font-variation-settings: "wdth" 100;
}
The direct width-axis setting can override the higher-level font-stretch request.
Using Extreme Widths for Body Text
Very narrow or wide character designs may reduce readability, particularly in long paragraphs.
Important Considerations
Keep the following points in mind when using the font-stretch property:
- Purpose: Selects condensed, normal, or expanded font width variations.
- Initial value:
normal. - Inheritance: The property is inherited.
- Applies to: All elements and text.
- Keywords: Nine named width categories are available.
- Percentages: Provide more precise width selection.
- Normal width:
100%. - Condensed widths: Values below
100%. - Expanded widths: Values above
100%. - Font availability: A visible change requires suitable width variations.
- Font matching: Browsers select the closest available width when an exact match is missing.
- Variable fonts: Compatible fonts can provide continuous width ranges.
- Width axis: The registered
wdthaxis controls width in compatible variable fonts. - @font-face: The
font-stretchdescriptor identifies a font resource's supported width or range. - Font size: The property does not change the specified
font-size. - Letter spacing: The property is different from
letter-spacing. - Transforms: The property does not horizontally scale an already rendered element.
- Animation: Percentage values can interpolate, with visible results depending on the font.
- Invalid values: Lengths and negative percentages are not accepted.
- Accessibility: Avoid extreme widths that make text difficult to read.
- Browser support: Modern browsers support the property, although available font widths determine the visual result.
Use font-stretch when the chosen font family provides suitable condensed or expanded designs. For variable fonts, percentages offer precise control while retaining standard CSS font matching behavior.
Browser Support
The CSS font-stretch property is Widely available in modern browsers, including Chrome, Edge, Firefox, and Safari.
Keyword-based font width selection has long-standing support. Percentage values and variable font width ranges are supported in current browsers, although older browser versions may have limitations.
Keyword Example
h1 {
font-stretch: condensed;
}
Percentage Example
h1 {
font-stretch: 85%;
}
Fallback Example
h1 {
font-stretch: condensed;
font-stretch: 75%;
}
Browsers that do not recognize percentage values can retain the earlier keyword declaration.
Feature Detection
@supports (font-stretch: 85%) {
.heading {
font-stretch: 85%;
}
}
For current compatibility information, visit Can I Use? and search for font-stretch.
Specifications
The font-stretch property is defined in the CSS Fonts Module, which describes font width selection, percentage values, and font matching behavior.
CSS Fonts Module Level 4: font-stretch Property
The CSS Fonts Module also defines how font faces are described using the @font-face rule.
CSS Fonts Module Level 4: @font-face Rule
For additional explanations and examples, see MDN Web Docs.
