Browser Support and Fallbacks
You'll learn how to safely use variable fonts while ensuring your site works everywhere, even in older browsers.
The Core Idea
Variable fonts are powerful, but not all browsers support them yet. Progressive enhancement means you start with a solid foundation (static fonts) and layer on advanced features (variable fonts) for browsers that can handle them. This way, everyone gets a usable experience—some just get an enhanced one.
Think of it like offering a basic bicycle to everyone, but giving a multi-speed bike to those who can ride it. Everyone can still get around; some just have more options.
How It Works
Your CSS can check if a browser supports variable fonts using @supports. Here's the strategy:
- Start with static fonts — Define a traditional
@font-facewith regular, bold, italic variants - Add variable font support — Use
@supportsto override with variable fonts only where supported - Use fallback values — When using
font-variation-settings, always pair it with standard properties likefont-weight
/* Static font fallback - works everywhere */
@font-face {
font-family: 'MyFont';
src: url('myfont-regular.woff2');
font-weight: 400;
}
/* Variable font - only loads if supported */
@supports (font-variation-settings: normal) {
@font-face {
font-family: 'MyFont';
src: url('myfont-variable.woff2');
}
}
/* Usage with fallback */
h1 {
font-weight: 700; /* Works in all browsers */
font-variation-settings: 'wght' 700; /* Enhancement for variable fonts */
}
This approach ensures your text always displays with appropriate styling, whether the browser understands variable fonts or not.
Key Takeaway: Always provide static font fallbacks before adding variable font enhancements—progressive enhancement keeps your typography functional across all browsers while delivering premium experiences where possible.