The font-stretch CSS property selects a normal, condensed, or expanded face from a font.
/* Keyword 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; /* Global values */ font-stretch: inherit; font-stretch: initial; font-stretch: unset;
Note: This property does not change the geometry of a font by stretching or shrinking it. Rather, like font-feature-settings or font-variant, it selects the most appropriate font face.
For example, on macOS, in addition to the more common Bold, Regular, Italic, and BoldItalic faces, the "Helvetica Neue" font offers a second set of faces with compact characters: Condensed. Browsers will render this font with the condensed faces for the values semi-condensed through ultra-condensed, and the normal faces for all other values:
If the specified font has no condensed or expanded faces, like the default "Times New Roman" on macOS, font-stretch will not have any visible effect:
normalsemi-condensed, condensed, extra-condensed, ultra-condensed
semi-expanded, expanded, extra-expanded, ultra-expanded
Font stretch values are interpolated in discrete steps. The interpolation happens as though the ordered values are equally spaced real numbers; the result is rounded to the nearest value, with values exactly halfway between two values rounded towards the later value, i.e., towards the most expanded one.
normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded
<div class="ultra stretch">This is text with the font extremely stretched.</div> <div class="stretch">This is text with the font stretched.</div> <div class="normal">This is text without font stretching.</div> <div class="condensed">This is text with the font condensed.</div> <div class="ultra condensed">This is text with the font extremely condensed.</div>
.ultra.stretch { font-stretch: ultra-expanded; }
.stretch { font-stretch: expanded; }
.normal { font-stretch: normal; }
.condensed { font-stretch: condensed; }
.ultra.condensed { font-stretch: ultra-condensed; } | Specification | Status | Comment |
|---|---|---|
| CSS Fonts Module Level 3 The definition of 'font-stretch' in that specification. | Candidate Recommendation | Initial definition |
Note: The font-stretch property was initially defined in CSS 2, but dropped in CSS 2.1 due to the lack of browser implementation. It was brought back in CSS 3.
| Initial value | normal |
|---|---|
| Applies to | all elements. It also applies to ::first-letter and ::first-line. |
| Inherited | yes |
| Media | visual |
| Computed value | as specified |
| Animation type | a font stretch |
| Canonical order | the unique non-ambiguous order defined by the formal grammar |
| Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
| Basic support | 48 | 12 | 9 | 9 | 35 | 11 |
| Feature | Android webview | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
|---|---|---|---|---|---|---|---|
| Basic support | No | ? | 12 | 9 | ? | No | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/font-stretch