Variable Font Axes
A traditional font family ships one file per weight and style. Six weights with matching italics means twelve separate downloads, twelve requests, and twelve chances for something to load slowly or fail. A variable font collapses that into a single file that encodes a continuous range along one or more design axes, so the browser can render any weight, width, or slant on demand from one download. This page goes deeper than the brief introduction in the Web Fonts reading: how to opt into the variations syntax, what each axis does, how to animate an axis, and how to decide whether a variable font actually saves bytes for your specific site.
Variable fonts are widely supported across Chrome, Edge, Firefox, and Safari, and have been for years. The behavior worth testing is which axes a specific font actually exposes and how custom axes render, since those vary by font rather than by browser. Check Can I Use: Variable Fonts for current support data, and confirm a font's axes on its type foundry or Google Fonts page before relying on them.
Opting Into the Variations Syntax
Loading a variable font looks almost like loading a static one, with two differences in the @font-face block. The format() hint gains a variations suffix, and the font-weight descriptor takes a range rather than a single number. That range tells the browser which weights the single file is able to satisfy.
@font-face {
font-family: 'Recursive';
src: url('/fonts/recursive-variable.woff2') format('woff2-variations');
font-weight: 300 1000;
font-style: normal;
font-display: swap;
}
With that range declared, any font-weight value between 300 and 1000 maps to the matching position along the font's weight axis. You are no longer limited to the handful of named weights a static family would provide. A heading can use font-weight: 820 and a caption can use font-weight: 340, and both come from the same file.
The Registered Axes
The OpenType specification defines five registered axes that have standardized meanings and, in most cases, a dedicated CSS property. When a CSS property exists for an axis, use it rather than the low-level syntax, because the property inherits and animates the way you would expect from any other CSS value.
Weight: wght
The weight axis controls stroke thickness and is the most widely supported. Its CSS property is font-weight, and the usual numeric values from 100 to 900 apply, though a variable font may extend beyond that range as Recursive does to 1000. Because font-weight is a standard inherited property, child elements receive the weight from their parent automatically.
Width: wdth
The width axis controls how condensed or extended the letterforms are, expressed as a percentage of normal width. Its CSS property is font-stretch, which accepts percentage values such as 75% for condensed or 125% for extended. Width is useful for fitting headlines into tight horizontal space without changing the font size.
Slant and Italic: slnt and ital
These two axes both produce sloped text but are not the same thing. The slant axis (slnt) tilts the upright letterforms by a number of degrees, typically expressed as a negative value for a forward lean. The italic axis (ital) switches to genuinely different italic glyph shapes, not merely a tilt. Their CSS property is font-style, where oblique 10deg drives slant and italic drives the italic axis. A font may expose one, the other, or both.
Optical Size: opsz
The optical size axis adjusts the design of the glyphs for the size at which they will be displayed, thickening thin strokes and opening up spacing at small sizes for legibility, and refining details at large display sizes. Its CSS property is font-optical-sizing, which defaults to auto so the browser drives the axis from the rendered font size automatically. You can set it to none to disable that behavior, or address the axis manually for deliberate effects.
Custom Axes and the Low-Level Syntax
Beyond the registered set, type designers can define custom axes identified by four-letter tags written in uppercase by convention. Recursive exposes two: MONO moves between a proportional sans and a fixed-width monospace, and CASL moves between a linear, neutral tone and a warmer, more casual one. Custom axes have no dedicated CSS property, so they must be set through font-variation-settings.
.casual-mono {
font-variation-settings: 'MONO' 1, 'CASL' 0.8;
}
You can drive registered axes through font-variation-settings too, using their lowercase tags such as 'wght' and 'slnt', but there is a meaningful reason to avoid doing so for registered axes. The font-variation-settings property does not inherit the way font-weight does. If you set a weight through font-variation-settings on a parent, child elements will not pick it up unless they declare it themselves. Worse, setting one axis through the property resets any other axes not listed in the same declaration back to their defaults. For registered axes, always prefer the dedicated CSS property and reserve font-variation-settings for the custom axes that have no other access path.
When you do use font-variation-settings, list every custom axis you care about in a single declaration. Because the property replaces rather than merges, a second declaration that names only one axis silently resets the others to their default positions.
Exploring the Axes
The playground below loads Recursive and exposes four of its axes: weight and slant from the registered set, and the MONO and CASL custom axes. Drag each control and watch the sample text respond, and watch the generated font-variation-settings string update beneath it so you can see exactly what your CSS would contain. This is provided to help you understand the relationship between an axis value and the rendered result. For your Teaching Video you are expected to build your own demonstration rather than relying on this one.
Animating an Axis
Because axis values are numbers, they can be transitioned and animated. A heading can ease from a lighter to a heavier weight on hover, or a logo can shift slowly between two widths. The mechanism is the same as any CSS animation, applied to font-variation-settings or to the dedicated property for a registered axis.
Animating the dedicated property is usually smoother and more predictable. A transition on font-weight works directly:
.animated-heading {
font-weight: 400;
transition: font-weight var(--transition-base);
}
.animated-heading:hover {
font-weight: 800;
}
For a custom axis with no dedicated property, you animate font-variation-settings directly. The browser interpolates between the start and end values of each named axis, so list every axis you intend to animate in both states:
.shift {
font-variation-settings: 'MONO' 0;
animation: shift 4s ease-in-out infinite alternate;
}
@keyframes shift {
to {
font-variation-settings: 'MONO' 1;
}
}
Animating font axes is more expensive than animating transform or opacity, because each frame can force the browser to re-rasterize the glyphs at the new axis position. Keep axis animations short and purposeful, prefer the dedicated property over font-variation-settings when one exists, and respect prefers-reduced-motion so visitors who ask for less motion are not subjected to continuously shifting type.
One advanced technique connects to the @property topic elsewhere in this unit. Registering a custom property as a typed number lets you animate a single axis value cleanly and feed it into font-variation-settings through a var() reference, which gives you smoother control than animating the whole property string at once. That pattern rewards exploration once you are comfortable with the basics shown here.
One Variable File Versus a Static Bundle
The headline benefit of a variable font is collapsing many files into one, but that benefit is not automatic. A variable file is larger than any single static weight because it carries the interpolation data for the entire range. Whether it saves bytes depends on how many weights and styles your site actually uses. The comparison below illustrates the tradeoff: a representative variable file weighed against a growing bundle of individual static cuts. Drag the slider to set how many static weights your design uses.
The lesson is not that variable fonts always win, but that they win past a threshold. If your design only ever uses a regular and a bold, two static files are lighter than one variable file. Once you reach for three or four weights, or you want fluid control over weight as part of your type scale, the variable file pulls ahead and gives you the entire range in between at no additional cost. Decide based on how many cuts your actual design calls for, not on the assumption that newer is automatically lighter.
Teaching Video Checklist
When you record your teaching video, make sure your teammates come away understanding these concepts:
-
How a single variable file replaces a stack of static weights, shown with the
@font-facevariations syntax and thefont-weightrange descriptor - The five registered axes and which CSS property drives each, demonstrated by changing weight, width, or slant on real text
-
Why custom axes require
font-variation-settingsand the replace-not-merge gotcha that comes with it -
That axis values animate, and the rendering-cost reason to keep those animations short and to respect
prefers-reduced-motion - Your own demo on your portfolio: a variable font loaded and at least one axis changed live, ideally driven by a control you built
Start by loading a variable font and showing the same family at several weights from one file, then change an axis live so teammates see the continuous range a static bundle cannot provide.
Resources
- MDN: Variable Fonts Guide is the full reference for every axis, the syntax, and the dedicated CSS properties
- MDN: font-variation-settings documents the low-level property and its inheritance behavior
- V-Fonts is a catalog of variable fonts you can browse by the axes they expose
- web.dev: Introduction to variable fonts on the web covers loading, performance, and the file-size tradeoff in depth
- Can I Use: Variable Fonts shows current browser support data