What is Fontstretch?
The font-stretch CSS property selects a normal, condensed, or expanded face from a font family. This property allows developers to programmatically control how wide or narrow text characters appear, providing fine-grained control over typography that goes beyond simple weight and style adjustments.
Unlike font-weight, which controls thickness, or font-style, which controls slant, font-stretch specifically targets the horizontal proportion of glyphs. This becomes particularly valuable when working with variable fonts that offer multiple width variations in a single font file.
The property has been formally renamed to font-width in recent CSS specifications, reflecting a more intuitive understanding of the property's function. However, font-stretch remains as a compatibility alias, ensuring that existing codebases continue to work while developers gradually transition to the new property name. This backward compatibility approach mirrors how other CSS properties have evolved over time, allowing gradual adoption without breaking changes.
For production websites using our web development services, this means you can confidently use font-stretch today while planning for the future property name update.
Understanding font-stretch enables precise typographic control
Keyword Values
Use semantic names like 'condensed', 'expanded', and 'ultra-condensed' for readable stylesheet code.
Percentage Control
Fine-tune width from 50% to 200% with continuous values for variable font flexibility.
Variable Font Integration
Access the full width axis (wdth) of variable fonts through a single @font-face declaration.
Inherited Behavior
Set font-stretch on containers to affect all descendant text elements consistently.
Understanding Font Width Values
Font-stretch accepts both keyword values and percentage values, each serving different use cases and levels of precision. The keyword values provide named widths ranging from ultra-condensed to ultra-expanded, while percentage values offer more granular control for variable fonts.
Keyword Values Reference
The CSS specification defines nine keyword values for font-stretch, each representing a specific point on the width spectrum:
| Keyword | Percentage | Description |
|---|---|---|
| ultra-condensed | 50% | Narrowest available width |
| extra-condensed | 62.5% | Very narrow variation |
| condensed | 75% | Narrow width for data tables |
| semi-condensed | 87.5% | Slightly narrower than normal |
| normal | 100% | Standard width (baseline) |
| semi-expanded | 112.5% | Slightly wider than normal |
| expanded | 125% | Wider variation for headlines |
| extra-expanded | 150% | Very wide display text |
| ultra-expanded | 200% | Widest available width |
These keywords provide semantic naming that makes stylesheets more readable and maintainable, especially when multiple developers work on the same codebase.
Percentage Values for Variable Fonts
Percentage values unlock the full potential of variable fonts by allowing any value between 50% and 200%. This continuous range enables smooth transitions and responsive typography that adapts to different screen sizes and design requirements.
When using percentage values, browsers map requests to the closest available font face. Values below 100% select narrower faces, while values at or above 100% select wider faces. This mapping ensures graceful degradation even when the exact requested percentage isn't available in the font file.
.responsive-text {
font-stretch: 87.5%;
}
.headline-large {
font-stretch: 125%;
}
Variable fonts like Inconsolata support the full 50% to 200% range, while others might only offer 75% to 125%. The browser intelligently handles these variations, selecting the closest match when an exact percentage isn't available.
1/* Keyword values for semantic width control */2.data-table {3 font-stretch: condensed;4}5 6.headline {7 font-stretch: expanded;8}9 10/* Percentage values for variable font precision */11.responsive-text {12 font-stretch: 87.5%;13}14 15.mega-headline {16 font-stretch: 150%;17}18 19/* Font shorthand with font-stretch */20.combined {21 font: italic 16px/1.5 "Roboto", sans-serif;22}The Role of Variable Fonts
Variable fonts revolutionized web typography by consolidating multiple font variations into single files. Rather than loading separate files for each width, weight, and style combination, developers can access the entire range through a single @font-face declaration and CSS properties.
The font-stretch property leverages the width axis of variable fonts, represented by the wdth tag in OpenType specifications. This axis defines the range of widths available in the font file, from ultra-condensed to ultra-expanded. When you set font-stretch in CSS, you're essentially positioning a point along this axis.
The efficiency gains over traditional static fonts are substantial. A typical font family might require 20-30 separate files for all width and weight combinations. A single variable font file, while larger than individual static files, often weighs less than the combined weight of all variations. More importantly, it eliminates HTTP request overhead and provides instant access to the entire design range without additional network requests.
For web applications built with modern frameworks like Next.js, variable fonts integrate seamlessly with the performance optimization strategies we implement. The reduced request count improves Core Web Vitals scores, while the single-file architecture simplifies caching and CDN distribution.
Beyond basic typography, variable fonts enable sophisticated design systems where typographic expressions can respond to user interaction, viewport changes, or accessibility preferences. This level of control was previously impossible without loading multiple font files and managing complex fallback logic.
Implementing Fontstretch with @font-face
When working with variable fonts, the @font-face declaration must specify the available stretch range. This declaration informs the browser about the font's capabilities and enables proper fallback behavior.
@font-face Descriptor
Chrome and some other browsers require the font-stretch descriptor for variable font support. Without this descriptor, the property may not work correctly. The descriptor uses percentage syntax to define the minimum and maximum supported widths:
@font-face {
font-family: "Inter Variable";
src: url("/fonts/Inter-Variable.woff2") format("woff2-variations");
font-weight: 100 900;
font-stretch: 75% 125%;
font-style: normal;
font-display: swap;
}
Font Face Selection Behavior
Understanding how browsers select font faces helps avoid unexpected results:
- Exact matches are preferred when available - the browser uses the precise width requested
- Values below 100% map to narrower faces, selecting from condensed variations
- Values at or above 100% map to wider faces, selecting from expanded variations
- Closest available face is selected when exact match doesn't exist
Practical examples of font selection behavior:
/* Font with 75%-125% range */
.test-narrow {
font-stretch: 50%; /* Clamps to 75% (minimum) */
}
.test-normal {
font-stretch: 100%; /* Exact match available */
}
.test-wide {
font-stretch: 110%; /* Selects closest: 112.5% or clamps */
}
.test-max {
font-stretch: 200%; /* Clamps to 125% (maximum) */
}
For fonts with limited width ranges, testing across the full spectrum reveals selection boundaries. Some fonts snap to minimum or maximum values outside their defined range, while others might interpolate between available faces when supported by the font file.
Implementing these techniques as part of a comprehensive web development strategy ensures consistent typography across all supported browsers and devices.
1@font-face {2 font-family: "Inter Variable";3 src: url("/fonts/Inter-Variable.woff2") format("woff2-variations");4 font-weight: 100 900;5 font-stretch: 75% 125%;6 font-style: normal;7 font-display: swap;8}9 10/* Using the variable font */11.typography-system {12 font-family: "Inter Variable", sans-serif;13}14 15/* Different width variations */16.data-focused {17 font-stretch: 75%;18}19 20.standard-text {21 font-stretch: 100%;22}23 24.display-heading {25 font-stretch: 125%;26}Practical Applications and Use Cases
Font-stretch serves diverse design needs across different contexts:
Data Visualization and Dashboards
Data-heavy interfaces benefit from condensed text that fits more information in limited spaces:
/* Compact data tables */
.data-table {
font-stretch: condensed;
font-size: 14px;
}
/* Financial metrics */
.metric-value {
font-stretch: 75%;
font-weight: 600;
}
/* Inline data labels */
.chart-label {
font-stretch: semi-condensed;
}
Editorial and Marketing Design
Marketing pages use expanded text for headlines and call-to-action elements:
/* Hero headlines */
.hero-headline {
font-stretch: expanded;
font-size: 3rem;
}
/* Call-to-action buttons */
.cta-button {
font-stretch: semi-expanded;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
}
/* Promotional banners */
.promo-text {
font-stretch: 112.5%;
}
Responsive Typography
Font-stretch enables adaptive typography that responds to viewport changes:
/* Mobile: condensed for narrow screens */
@media (max-width: 640px) {
.responsive-heading {
font-stretch: 87.5%;
}
}
/* Desktop: expanded for wide screens */
@media (min-width: 1024px) {
.responsive-heading {
font-stretch: expanded;
font-size: 2.5rem;
}
}
/* Data tables that adapt to space */
.adaptive-table {
font-stretch: clamp(75%, 4vw, 100%);
}
These techniques are particularly effective when combined with other responsive typography approaches we implement in custom web applications.
Variable Font Efficiency
50%
Typical HTTP request reduction
9
Width variation keywords available
200%
Maximum stretch percentage
1
File for all width variations
Performance Considerations
Font-stretch contributes to web performance through its association with variable fonts:
HTTP Request Reduction
By consolidating multiple font files into one, variable fonts reduce HTTP requests significantly. A typical font family might require 20-30 separate files for all width and weight combinations. A single variable font file often weighs less than the combined weight of all variations while eliminating the connection overhead for multiple requests.
Font Loading Strategy
The font-display property controls how fonts load relative to page rendering, which directly impacts perceived performance:
@font-face {
font-family: "Variable Font";
src: url("/fonts/variable.woff2") format("woff2-variations");
font-display: swap;
}
The swap value ensures text remains visible during font loading, preventing the flash of invisible text (FOIT). For performance-critical applications, consider font-display: optional which only loads fonts if they're already cached.
Preloading and Caching
Preloading critical variable fonts can eliminate layout shifts caused by font switching:
<link rel="preload" href="/fonts/variable.woff2"
as="font" type="font/woff2" crossorigin>
For production deployments, configure appropriate cache headers. Variable fonts are static assets that benefit from long cache durations:
Cache-Control: public, max-age=31536000, immutable
These performance strategies are essential components of the performance optimization we deliver in every web project. Well-optimized typography not only improves load times but also enhances SEO performance by reducing cumulative layout shift and improving user engagement metrics.
Browser Support and Compatibility
Modern browsers provide comprehensive font-stretch support, with some important caveats:
Browser Requirements
- Chrome/Edge: Require font-stretch descriptor in @font-face for variable fonts. The
format("woff2-variations")specifier is essential for proper recognition. - Firefox: More flexible, can infer stretch ranges from font files without explicit descriptors
- Safari: Full support with proper @font-face declarations, including iOS Safari
- Mobile browsers: Support follows desktop equivalents across iOS and Android
Font-Width Alias
The font-stretch property has been renamed to font-width in recent CSS specifications. The old name remains as a compatibility alias, so code written with font-stretch continues to work while the new property name awaits full browser implementation. This gradual transition approach ensures existing codebases remain functional.
Fallback Behavior
The property gracefully degrades on non-supporting browsers--no errors occur, and text renders at normal width. This makes progressive enhancement straightforward. For browsers or fonts without width variation support, the font-stretch declaration is simply ignored.
To ensure consistent rendering, provide fallback fonts that include condensed or expanded variations:
.data-table {
font-family: "Variable Condensed", "Condensed Fallback", sans-serif;
font-stretch: condensed;
}
This approach ensures readable text even when variable font features aren't available. Building with these fallbacks in mind is a hallmark of robust web development practices.
Best Practices for Production
Implementing font-stretch effectively requires attention to font selection, CSS organization, and progressive enhancement.
Font Selection
Choose variable fonts that support the width variations your design requires:
- Review font documentation to confirm available axes and their ranges
- Test across browsers to verify consistent behavior
- Consider font quality at different width settings
- Evaluate licensing terms for variable font use
CSS Organization
Create utility classes for common width variations to maintain consistency across your project:
/* Width utility classes */
.font-stretch-condensed {
font-stretch: condensed;
}
.font-stretch-semi-condensed {
font-stretch: semi-condensed;
}
.font-stretch-normal {
font-stretch: normal;
}
.font-stretch-expanded {
font-stretch: expanded;
}
/* Percentage-based utilities */
.font-stretch-75 {
font-stretch: 75%;
}
.font-stretch-87-5 {
font-stretch: 87.5%;
}
.font-stretch-112-5 {
font-stretch: 112.5%;
}
.font-stretch-125 {
font-stretch: 125%;
}
Progressive Enhancement
Provide fallback fonts for browsers or devices without font-stretch support:
.data-table {
font-family: "Condensed Font", "Fallback Sans", sans-serif;
font-stretch: condensed;
}
Documentation
Document font-stretch usage in design systems:
- Define available width variations and their intended use cases
- Specify which fonts support each width level
- Include accessibility considerations for different widths
- Provide cross-reference to related typography properties like font-weight and font-style
These practices ensure maintainable, accessible, and performant typography in your modern web applications. For teams building intelligent systems, combining variable fonts with AI-powered automation can create adaptive user experiences that respond to individual preferences.