High-Level Properties for Standard Axes
What you'll learn: How to control variable fonts using familiar CSS properties instead of the low-level font-variation-settings.
Variable fonts have standard axes like weight, width, and slant—and CSS already has properties for those! Instead of wrestling with the cryptic font-variation-settings syntax, you can use the high-level properties you already know: font-weight, font-stretch, and font-style.
Why High-Level Properties Matter
Think of font-variation-settings as manually shifting gears in a car—it works, but requires knowing exact axis codes. High-level properties are like an automatic transmission: they handle the technical details for you.
When working with variable fonts, these familiar properties automatically map to the corresponding variation axes:
font-weightcontrols thewghtaxis (e.g.,font-weight: 450)font-stretchcontrols thewdthaxis (e.g.,font-stretch: 87%)font-style: obliquewith an angle controls theslntaxis (e.g.,font-style: oblique 12deg)
The Advantage
/* Instead of this low-level approach: */
h1 {
font-variation-settings: 'wght' 650;
}
/* Use this familiar, readable approach: */
h1 {
font-weight: 650;
}
Both achieve the same result, but the high-level property is easier to read, plays nicely with CSS inheritance, and works even if the font isn't variable (falling back gracefully to the nearest weight).
Browser Compatibility
These high-level properties also cascade and animate better than font-variation-settings, which treats the entire value as one unit. With font-weight, you can transition smoothly between values.
Key Takeaway: Use font-weight, font-stretch, and font-style to control standard variable font axes—they're simpler, more maintainable, and better supported than low-level font-variation-settings for common adjustments.