Spec-Zone.ru › CSS

`font-stretch` CSS at-rule descriptor

Baseline Widely available

This feature is well established and works across many devices and browser versions. It's been available across browsers since January 2020.

Note: The font-stretch descriptor was renamed to font-width in the CSS Fonts specification. To preserve compatibility, the specification retains font-stretch as a legacy alias for the font-width descriptor.

The font-stretch CSS descriptor allows authors to specify a normal, condensed, or expanded face for the fonts specified in the @font-face at-rule.

For a particular font family, authors can download various font faces corresponding to the different styles of the same font family, and then use the font-stretch descriptor to specify the font face's stretch explicitly.

Syntax

/* Single values */
font-stretch: ultra-condensed;
font-stretch: extra-condensed;
font-stretch: condensed;
font-stretch: semi-condensed;
font-stretch: normal;
font-stretch: semi-expanded;
font-stretch: expanded;
font-stretch: extra-expanded;
font-stretch: ultra-expanded;
font-stretch: 50%;
font-stretch: 100%;
font-stretch: 200%;

/* Multiple values */
font-stretch: 75% 125%;
font-stretch: condensed ultra-condensed;

The font-stretch descriptor can take a single value from the list below.

Values

normal
Specifies a normally condensed font face.
semi-condensed, condensed, extra-condensed, ultra-condensed
Specifies a more condensed font face than normal, with ultra-condensed being the most condensed.
semi-expanded, expanded, extra-expanded, ultra-expanded
Specifies a more expanded font face than normal, with ultra-expanded being the most expanded.
<percentage>
A <percentage> value between 50% and 200% (inclusive). Negative values are not allowed for this descriptor.

In earlier versions of the font-stretch specification, the descriptor accepts only the nine keyword values. CSS Fonts Level 4 extends the syntax to accept a <percentage> value as well. This enables variable fonts to offer a continuous variation of character widths. For TrueType or OpenType variable fonts, the wdth variation is used to implement varying widths.

If the font does not provide a face that exactly matches the given value, then values less than 100% map to a condensed face, and values greater than or equal to 100% map to an expanded face.

Keyword to numeric mapping

The table below shows the mapping between keyword values and numeric percentages:

Keyword Percentage
ultra-condensed 50%
extra-condensed 62.5%
condensed 75%
semi-condensed 87.5%
normal 100%
semi-expanded 112.5%
expanded 125%
extra-expanded 150%
ultra-expanded 200%

Variable fonts

Most fonts have a particular width that corresponds to one of the keyterm values. However, variable fonts can support a range of widths with fine granularity, giving the designer a greater degree of control over the chosen weight. For this, percentage ranges are useful.

For TrueType or OpenType variable fonts, the wdth variation is used to implement varying glyph widths.

Accessibility

People with dyslexia and other cognitive conditions may have difficulty reading fonts that are too condensed, especially if the font has a low color contrast ratio.

  • MDN Understanding WCAG, Guideline 1.4 explanations
  • [Understanding Success Criterion 1.4.8 W3C Understanding WCAG 2.0](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-visual-presentation.html)

Formal definition

Formal syntax

Examples

Setting a percentage range for font-stretch

The following example uses the League Mono font. It synthesizes different font families from the same font file using the font-stretch descriptor with different keywords and percentages.

<p>League Mono</p>
<p>League Mono</p>
<p>League Mono</p>
@font-face {
  font-family: "League Mono Ultra Condensed";
  src: url("/shared-assets/fonts/LeagueMono-VF.ttf") format("truetype");
  font-stretch: ultra-condensed; /* same as 50% */
}

@font-face {
  font-family: "League Mono Normal";
  src: url("/shared-assets/fonts/LeagueMono-VF.ttf") format("truetype");
  font-stretch: 100%; /* same as normal */
}

@font-face {
  font-family: "League Mono Ultra Expanded";
  src: url("/shared-assets/fonts/LeagueMono-VF.ttf") format("truetype");
  font-stretch: ultra-expanded; /* same as 200% */
}

p:nth-child(1) {
  font-family: "League Mono Ultra Condensed", sans-serif;
}

p:nth-child(2) {
  font-family: "League Mono Normal", sans-serif;
}

p:nth-child(3) {
  font-family: "League Mono Ultra Expanded", sans-serif;
}

Specifications

Specification
CSS Fonts Module Level 4
# font-stretch-desc

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Opera Safari Chrome Android Firefox for Android Opera Android Safari on iOS Samsung Internet WebView Android WebView on iOS
font-stretch
62
17
62
49
10.1
62
62
41
10.3
6.0
62
10.3

See also

  • Modern font-width descriptor, replacing font-stretch
  • font-display descriptor
  • font-family descriptor
  • font-weight descriptor
  • font-style descriptor
  • font-feature-settings descriptor
  • font-variation-settings descriptor
  • src descriptor
  • unicode-range descriptor

© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@font-face/font-stretch

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API