Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Typography

The font-variant property

Reference for the CSS font-variant shorthand: small-caps and the font-variant longhands for caps, numerals, ligatures and more, with live examples and notes.

The font-variant property is a shorthand for a group of properties that switch typographic variants of a font on or off: small capitals, numeral styles, ligatures, East Asian forms, alternates, super and subscripts, and emoji presentation. The value people use most is small-caps.

Because it is a shorthand, writing font-variant resets every longhand it covers to normal unless you set them in the same declaration. The longhands only change text if the font actually contains the variant.

CSS
.label {
  font-variant: small-caps;
}

.table-figures {
  font-variant: tabular-nums slashed-zero;
}

Try it

Small caps and figures

If the font has no real small capitals, browsers synthesize them by shrinking capitals, which looks lighter than a designed set. The font-variant-caps page explains how to control that.

Syntax

CSS
font-variant: normal | none
            | [ <common-lig-values> || <discretionary-lig-values>
              || <historical-lig-values> || <contextual-alt-values>
              || stylistic(<feature-value-name>) || historical-forms
              || styleset(<feature-value-name>#) || character-variant(<feature-value-name>#)
              || swash(<feature-value-name>) || ornaments(<feature-value-name>)
              || annotation(<feature-value-name>)
              || [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ]
              || <numeric-figure-values> || <numeric-spacing-values>
              || <numeric-fraction-values> || ordinal || slashed-zero
              || <east-asian-variant-values> || <east-asian-width-values> || ruby
              || [ sub | super ] || [ text | emoji | unicode ] ];
Initial value normal
Applies to All elements and text
Inherited Yes
Animatable No
Computed value As each longhand

Values

Value Description
normal Resets all variant longhands to their default behavior.
none Turns ligatures off and sets everything else to normal.
small-caps, all-small-caps, โ€ฆ Sets font-variant-caps.
lining-nums, tabular-nums, slashed-zero, โ€ฆ Sets font-variant-numeric.
no-common-ligatures, discretionary-ligatures, โ€ฆ Sets font-variant-ligatures.
sub, super Sets font-variant-position.
text, emoji, unicode Sets font-variant-emoji; support varies.
East Asian values (jis78, full-width, ruby, โ€ฆ) Set font-variant-east-asian.

Usage notes

  • Prefer the longhands. font-variant: small-caps is fine, but when you only want one feature, the matching longhand does not reset the others by accident.
  • Reset effect. A rule like font-variant: small-caps after font-variant-numeric: tabular-nums removes the numeric setting. Order matters.
  • Need font support. None of the variants do anything unless the font contains them, except small caps (and sub/super), which browsers can synthesize.
  • Lower-level control. font-feature-settings reaches OpenType features that have no named property, but it is harder to maintain.
  • Do not fake caps by hand. Typing in uppercase at a smaller size produces thin strokes; small-caps with a font that supports it keeps stroke weight consistent.
  • Accessibility. Variant properties change appearance only; the underlying text stays the same for assistive technology.

Browser support

small-caps is supported everywhere, and the main longhands are well supported in current browsers; font-variant-emoji is newer, so check a compatibility table before using it.