Course contentsShow
← Web Development
Lesson 1289 of 2,98223. Web Font OptimizationFree lesson

font-variation-settings Property

Using font-variation-settings to control variable font axes with low-level CSS syntax.

font-variation-settings Property

What you'll learn: How to use the low-level font-variation-settings CSS property to directly control variable font axes.

What Is font-variation-settings?

While variable fonts give you access to multiple design variations in a single file (weight, width, slant, etc.), you need a way to control those axes in your CSS. The font-variation-settings property is the low-level syntax that lets you directly manipulate any registered axis in a variable font.

Think of it like adjusting individual dials on a stereo equalizer—each axis is a slider you can fine-tune to exact values.

How It Works

The property takes a string containing one or more four-character axis tags followed by numeric values:

.custom-text {
  font-variation-settings: 'wght' 650;
}

This sets the weight axis (wght) to 650. You can control multiple axes at once by separating them with commas:

.fancy-heading {
  font-variation-settings: 'wght' 700, 'wdth' 85, 'slnt' -5;
}

Here we're setting weight to 700, width to 85%, and slant to -5 degrees—all in one declaration.

Axis Tag Names

The four-character tags are standardized:

  • 'wght' = weight (100–900)
  • 'wdth' = width (percentage)
  • 'slnt' = slant (degrees)
  • 'ital' = italic (0 or 1)

Custom axes use uppercase tags, like 'GRAD' for grade.

Important Considerations

This is a low-level property. It doesn't inherit or cascade nicely—you must specify all axes you want to change every time. Missing an axis resets it to default. For production, higher-level properties like font-weight are often preferred when they map to standard axes.

Key Takeaway: font-variation-settings gives you direct, precise control over variable font axes using four-character tags and numeric values, though it requires listing all desired axes in each declaration.