CSS font-width Property
The font-width property selects a condensed, normal, or expanded font face from the available font family.
Font width can be specified using keywords such as condensed and expanded, or percentages that describe the requested width variation. The property is the newer name for font-stretch and works with font families that provide different width designs, including variable fonts with a width axis.
font-width Syntax
The font-width property accepts a width keyword or a percentage value. Percentages must be greater than zero.
Basic Syntax
selector {
font-width: normal;
}
Condensed Font
selector {
font-width: condensed;
}
Expanded Font
selector {
font-width: expanded;
}
Percentage Value
selector {
font-width: 85%;
}
Variable Font Width
selector {
font-width: 112.5%;
}
CSS-Wide Keywords
.example {
font-width: inherit;
}
.example {
font-width: initial;
}
.example {
font-width: unset;
}
.example {
font-width: revert;
}
.example {
font-width: revert-layer;
}
The requested width is used during font selection. It does not directly set the CSS width of an element or resize its containing box.
Property Values
The property provides nine named width categories and supports percentage values for more precise selection.
| Keyword | Equivalent Percentage | Description |
|---|---|---|
ultra-condensed |
50% | Requests a very narrow font face. |
extra-condensed |
62.5% | Requests an extra 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 considerably expanded font face. |
ultra-expanded |
200% | Requests a very wide font face. |
<percentage> |
Greater than 0% | Requests a specific font width using a percentage. |
Property Characteristics
| Characteristic | Value |
|---|---|
| Initial value | normal (100%) |
| Inherited | Yes |
| Applies to | All elements and text |
| Computed value | A percentage |
| Animation type | By computed value type (percentage) |
| Percentage reference | The font's normal width, not the containing element |
Keyword values are converted to their corresponding percentages for computation. The percentage describes the requested font width variation rather than a guaranteed visual scaling factor.
How It Works
The browser uses font-width when choosing a font face from the selected family.
Select a Font Family
.heading {
font-family: "Example Sans", sans-serif;
}
Request a Width
.heading {
font-width: condensed;
}
Select an Available Face
If the family provides a matching condensed face, the browser can select it. Otherwise, the browser chooses an appropriate available width using CSS font matching rules.
Variable Font Selection
When the selected font supports a width variation axis, the browser may use an intermediate width instead of selecting only from separate static faces.
No Automatic Geometric Stretching
The property requests a font design. It does not automatically stretch or compress every glyph as a CSS transform would.
Important Consideration
If a font family provides only one width, different font-width values may produce the same visible result.
Font Width Keywords
Width keywords provide descriptive names for common condensed and expanded font categories.
Normal Width
.normal-text {
font-width: normal;
}
The normal value is equivalent to 100% and requests the font's standard width.
Semi-Condensed Width
.semi-condensed-text {
font-width: semi-condensed;
}
This requests a slightly narrower font design, equivalent to 87.5%.
Condensed Width
.condensed-text {
font-width: condensed;
}
This requests a condensed font design, equivalent to 75%.
Extra-Condensed Width
.extra-condensed-text {
font-width: extra-condensed;
}
This requests a narrower design, equivalent to 62.5%.
Ultra-Condensed Width
.ultra-condensed-text {
font-width: ultra-condensed;
}
This requests the narrowest named width category, equivalent to 50%.
Semi-Expanded Width
.semi-expanded-text {
font-width: semi-expanded;
}
This requests a slightly wider design, equivalent to 112.5%.
Expanded Width
.expanded-text {
font-width: expanded;
}
This requests a wider font design, equivalent to 125%.
Extra-Expanded Width
.extra-expanded-text {
font-width: extra-expanded;
}
This requests a considerably wider design, equivalent to 150%.
Ultra-Expanded Width
.ultra-expanded-text {
font-width: ultra-expanded;
}
This requests the widest named category, equivalent to 200%.
Important Consideration
These keywords identify requested widths. They do not guarantee that a font family contains every corresponding design.
Percentage Values
Percentage values allow more precise font width selection than the predefined keywords.
Narrower Than Normal
.narrow-heading {
font-width: 85%;
}
Normal Width
.normal-heading {
font-width: 100%;
}
Wider Than Normal
.wide-heading {
font-width: 120%;
}
Fractional Percentages
.heading {
font-width: 92.5%;
}
Values Above 200%
.heading {
font-width: 225%;
}
Values above 200% are syntactically valid. However, the selected font may not support such a wide design.
Invalid Percentage
.heading {
font-width: 0%;
}
A value of 0% is invalid because the property requires a percentage greater than zero.
Important Consideration
Percentages do not refer to the containing block's width. They specify a font width selection relative to the font's normal width.
Condensed Fonts
Condensed font faces use narrower letterforms, allowing more characters to fit within a given line length.
Condensed Heading
.page-heading {
font-width: condensed;
}
Semi-Condensed Navigation
.navigation {
font-width: semi-condensed;
}
Condensed Display Text
.display-title {
font-size: 48px;
font-weight: 700;
font-width: 75%;
}
Typical Uses
Condensed fonts are often used for headings, navigation labels, compact interface text, and display typography where horizontal space is limited.
Readability
Extremely narrow letterforms may become difficult to read at small sizes. Use moderate condensation for longer text and test the result at different viewport widths.
Important Consideration
A condensed design must be available within the selected font family. Requesting condensed does not guarantee that a standard-width font will become narrower.
Expanded Fonts
Expanded font faces use wider letterforms and can create a more open appearance for headings and display text.
Expanded Heading
.page-heading {
font-width: expanded;
}
Semi-Expanded Label
.section-label {
font-width: semi-expanded;
}
Extra-Expanded Display Text
.display-heading {
font-size: 40px;
font-weight: 600;
font-width: extra-expanded;
}
Typical Uses
Expanded fonts can be useful for short headings, logos, promotional typography, and other display text where additional horizontal space is available.
Layout Considerations
Wider font designs may increase line length, cause text to wrap, or create overflow in narrow containers.
Important Consideration
Expanded width does not automatically add letter spacing. It selects a wider font design when the family provides one.
Font Matching
When the exact requested font width is unavailable, the browser selects the closest suitable width according to CSS font matching rules.
Requesting a Condensed Width
.heading {
font-family: "Example Sans", sans-serif;
font-width: 75%;
}
Requesting an Expanded Width
.heading {
font-family: "Example Sans", sans-serif;
font-width: 125%;
}
Matching Narrow Widths
For requested widths at or below 100%, the browser first searches available widths from the requested value toward narrower designs. If none are available, it searches wider designs.
Matching Wide Widths
For requested widths above 100%, the browser first searches available widths from the requested value toward wider designs. If none are available, it searches narrower designs.
Single-Width Font Families
If a family contains only normal-width faces, the browser may use that same face for condensed and expanded requests.
Important Consideration
Font matching selects among available designs. The requested percentage is not necessarily the width of the face ultimately displayed.
Variable Fonts
Variable fonts may provide a continuous width range through the registered "wdth" axis.
Basic Variable Font Example
.variable-heading {
font-family: "Example Variable", sans-serif;
font-width: 85%;
}
Different Width Values
.variable-narrow {
font-width: 75%;
}
.variable-normal {
font-width: 100%;
}
.variable-wide {
font-width: 125%;
}
Intermediate Widths
.variable-heading {
font-width: 92.5%;
}
Weight and Width Together
.variable-heading {
font-weight: 650;
font-width: 85%;
}
Width Axis Support
A variable font must contain a suitable width axis to provide continuous changes. Some variable fonts support only weight, optical size, or other axes.
Important Consideration
Check the font's supported width range. A font that supports 75% to 125% cannot provide an exact 50% design simply because the CSS requests one.
Using font-width with @font-face
Web fonts can declare their supported width through the font-width descriptor in @font-face. The established font-stretch descriptor is also used for compatibility.
Normal-Width Font File
@font-face {
font-family: "Example Sans";
src: url("/fonts/example-regular.woff2") format("woff2");
font-stretch: normal;
font-display: swap;
}
Condensed Font File
@font-face {
font-family: "Example Sans";
src: url("/fonts/example-condensed.woff2") format("woff2");
font-stretch: condensed;
font-display: swap;
}
Apply the Font
.heading {
font-family: "Example Sans", sans-serif;
font-width: condensed;
}
Variable Font Width Range
@font-face {
font-family: "Example Variable";
src: url("/fonts/example-variable.woff2") format("woff2");
font-weight: 100 900;
font-stretch: 75% 125%;
font-display: swap;
}
Use an Intermediate Width
.variable-heading {
font-family: "Example Variable", sans-serif;
font-width: 92.5%;
}
Important Consideration
The descriptor identifies the widths provided by a font resource, while the property requests a width for an element. The declared ranges must match the actual font files.
The font paths shown are examples. Replace them with the correct locations of your web font files.
font-width and font-stretch
The font-width property is the newer name for font-stretch. Both describe the requested width of a font face.
Using font-stretch
.heading {
font-stretch: condensed;
}
Using font-width
.heading {
font-width: condensed;
}
Percentage Values
.heading {
font-stretch: 85%;
font-width: 85%;
}
Compatibility Fallback
.heading {
font-stretch: condensed;
font-width: condensed;
}
In browsers that recognize font-width, the later declaration takes effect. Browsers that do not recognize it can continue using font-stretch.
Important Consideration
Because font-stretch has broader historical support, include it as a fallback when supporting browsers that do not yet recognize font-width.
Comparison with font-variation-settings
The font-width property provides high-level font width selection, while font-variation-settings allows direct control of the variable font "wdth" axis.
High-Level Width Selection
.heading {
font-width: 85%;
}
Low-Level Width Axis
.heading {
font-variation-settings: "wdth" 85;
}
Comparison
| Feature | font-width | font-variation-settings |
|---|---|---|
| Purpose | Selects a font width. | Controls named variable font axes. |
| Static font faces | Can select available condensed or expanded faces. | Does not provide variation-axis control for static fonts. |
| Variable fonts | Can select supported width variations. | Can control the width axis directly. |
| Syntax | font-width: 85%; |
font-variation-settings: "wdth" 85; |
| Preferred use | General font width selection. | Specialized variable font control. |
Conflicting Settings
.heading {
font-width: 100%;
font-variation-settings: "wdth" 75;
}
When the font supports the "wdth" axis, the direct variation setting can override the width normally selected through font-width.
Important Consideration
Prefer high-level font properties for ordinary typography. Use font-variation-settings when direct access to variable font axes is necessary.
Font Width vs. Font Size and Spacing
Font width, font size, and letter spacing affect different aspects of text appearance.
Font Width
.heading {
font-width: condensed;
}
This requests narrower glyph designs when available.
Font Size
.heading {
font-size: 32px;
}
This controls the size of the text.
Letter Spacing
.heading {
letter-spacing: 2px;
}
This adjusts spacing between characters without selecting a different font width design.
CSS Width
.heading {
width: 300px;
}
This controls the width of the element's box, not the width design of its font.
CSS Transform
.heading {
transform: scaleX(0.85);
}
This visually scales the rendered element horizontally. It does not select a condensed font face, and the transformed appearance does not change the element's original layout dimensions.
Important Consideration
Use font-width to select a designed font width, letter-spacing to adjust character spacing, and width to control an element's layout box.
Animating Font Width
Font width percentages can be animated. Variable fonts with a supported width axis can provide smooth transitions between width designs.
Basic Transition
.animated-heading {
font-width: 100%;
transition: font-width 300ms ease;
}
.animated-heading:hover {
font-width: 75%;
}
Compatibility Fallback
.animated-heading {
font-stretch: 100%;
font-width: 100%;
transition: font-stretch 300ms ease, font-width 300ms ease;
}
.animated-heading:hover {
font-stretch: 75%;
font-width: 75%;
}
Keyframe Animation
@keyframes font-width-change {
from {
font-width: 75%;
}
to {
font-width: 125%;
}
}
.animated-text {
animation: font-width-change 2s ease-in-out infinite alternate;
}
Respect Reduced Motion
@media (prefers-reduced-motion: reduce) {
.animated-heading {
transition: none;
}
.animated-text {
animation: none;
}
}
Important Consideration
Changing font width can alter line wrapping and element dimensions. Test animated typography carefully, especially in responsive layouts.
When a font provides only separate static widths, intermediate animation values may not produce a smooth visual transition.
Inheritance
The font-width property is inherited. Child elements receive the parent's computed width unless another value is specified.
Inherited Width
.content {
font-width: condensed;
}
<div class="content">
<h2>Section Heading</h2>
<p>Paragraph text inherits the requested font width.</p>
</div>
Override a Child Element
.content {
font-width: condensed;
}
.content .normal-text {
font-width: normal;
}
Explicit Inheritance
.child {
font-width: inherit;
}
Reset to Initial Value
.child {
font-width: initial;
}
Important Consideration
Inherited font width settings can affect headings, paragraphs, buttons, and other text. Scope width changes to the components that need them.
font-width Example
This example compares condensed, normal, and expanded width requests. It uses font-stretch as a fallback for browsers that do not recognize font-width.
HTML Example
<div class="font-width-demo">
<p class="demo-label">Condensed - 75%</p>
<p class="demo-condensed">Responsive Typography</p>
<p class="demo-label">Normal - 100%</p>
<p class="demo-normal">Responsive Typography</p>
<p class="demo-label">Expanded - 125%</p>
<p class="demo-expanded">Responsive Typography</p>
</div>
CSS Example
.font-width-demo {
font-family: Arial, sans-serif;
}
.font-width-demo .demo-label {
margin: 0 0 6px;
font: 600 13px/1.4 Arial, sans-serif;
}
.font-width-demo .demo-condensed,
.font-width-demo .demo-normal,
.font-width-demo .demo-expanded {
margin: 0 0 20px;
font-size: 26px;
line-height: 1.4;
}
.font-width-demo .demo-condensed {
font-stretch: 75%;
font-width: 75%;
}
.font-width-demo .demo-normal {
font-stretch: 100%;
font-width: 100%;
}
.font-width-demo .demo-expanded {
font-stretch: 125%;
font-width: 125%;
}
Condensed - 75%
Responsive Typography
Normal - 100%
Responsive Typography
Expanded - 125%
The example uses Arial, which may not provide separate condensed and expanded faces. Consequently, the three lines may appear identical.
To see the intended differences, use a font family with condensed and expanded faces or load a variable font that supports the "wdth" axis.
Common Mistakes
Common mistakes involve unsupported fonts, invalid values, and confusion between font width and element dimensions.
Using Pixel Values
.heading {
font-width: 85px;
}
This declaration is invalid. The property accepts width keywords or percentages, not pixel values.
Using Unitless Numeric Values
.heading {
font-width: 85;
}
This declaration is invalid. Use 85% instead.
Using Zero or Negative Percentages
.heading {
font-width: 0%;
}
Percentages must be greater than zero.
Using an Invalid Keyword
.heading {
font-width: narrow;
}
The narrow keyword is not valid. Use condensed, semi-condensed, or a supported percentage.
Assuming Every Font Supports Width Variations
Many font families provide only a normal-width design. Different width requests may therefore produce identical results.
Confusing font-width with width
The font-width property selects a font design. The width property controls an element's layout box.
Confusing font-width with letter-spacing
Letter spacing changes the distance between characters, while font width selects different glyph proportions.
Forgetting Browser Compatibility
The newer font-width name is not supported by every browser that supports font-stretch. Include a fallback when necessary.
Conflicting Variable Font Settings
A direct "wdth" setting may override the width selected through font-width.
Important Considerations
Keep the following points in mind when using the font-width property:
- Purpose: Selects a condensed, normal, or expanded font face.
- Initial value:
normal, equivalent to 100%. - Inheritance: The property is inherited.
- Applies to: All elements and text.
- Keywords: Nine named width categories are available.
- Percentages: Values greater than 0% are valid.
- Normal width:
100%requests the standard width. - Condensed width: Values below 100% request narrower font designs.
- Expanded width: Values above 100% request wider font designs.
- Font availability: The selected family must provide suitable width variations.
- Font matching: Browsers select available widths when an exact match is unavailable.
- Variable fonts: May provide continuous width ranges through the
"wdth"axis. - Static fonts: May provide separate condensed or expanded faces.
- font-stretch: The established property name with broader historical support.
- Compatibility: Use
font-stretchas a fallback where appropriate. - @font-face: Font width descriptors identify available width designs or ranges.
- font-variation-settings: Can control the variable font width axis directly.
- font-size: Controls text size, not font width selection.
- letter-spacing: Controls spacing between characters.
- width: Controls the element's box width.
- Animations: Width percentages can interpolate, with smooth results depending on the font.
- Responsive layouts: Width changes may affect line wrapping and text dimensions.
- Readability: Avoid excessive condensation for long passages or small text.
Use font-width when the selected font family offers width variations. For reliable results, verify the font's available widths and provide a font-stretch fallback where needed.
Browser Support
The CSS font-width property has Limited availability compared with the older font-stretch property. Support for the newer name varies by browser and version.
For broader compatibility, declare font-stretch first and follow it with font-width.
Compatibility Example
.heading {
font-stretch: condensed;
font-width: condensed;
}
Feature Detection
@supports (font-width: condensed) {
.heading {
font-width: condensed;
}
}
Variable Font Support
Support for the property does not guarantee that the selected font contains a width axis or separate condensed and expanded faces.
Browser Compatibility
For current compatibility information, visit Can I Use? and search for font-width.
Specifications
The font-width property is defined in the CSS Fonts Module, which describes font width selection, matching, and variable font controls.
CSS Fonts Module Level 4: font-width
The specification also describes the relationship between font-width and font-stretch.
For additional explanations and examples, see MDN Web Docs.
