The home where you level up

Save my spot

font-variant-caps

Term side of the Card.
Topic: Font Features
Unit title: font-variant-caps
Categories: Property
Explanation side of the Card

Explanation: The property that selects alternate glyphs for capital letters, like 'small-caps', 'all-small-caps' or 'titling-caps'. It uses real small-cap glyphs from the font when available, which looks better than shrunk capitals.

Browser compatibility:
  • The chrome browser supports this feature starting from version 52.
  • The edge browser supports this feature starting from version 79.
  • The firefox browser supports this feature starting from version 34.
  • The safari browser supports this feature starting from version 9.1.
Availability: 

Example

Wrongcss
abbr {
  text-transform: uppercase;
  font-size: 0.8em;
}
Rightcss
abbr {
  font-variant-caps: all-small-caps;
}

'all-small-caps' uses the font's small-cap glyphs, which match the stroke weight of the surrounding text.

Common mistakes

  • Writing acronyms in uppercase and shrinking them with font-size, which looks too thin.
  • Small caps look synthetic because the font has no small-cap glyphs.

Key points

  • Small caps use font-variant-caps, not text-transform: uppercase with a smaller font size.
  • 'all-small-caps' is used for acronyms, so capital letters also become small caps.
  • The text in HTML keeps its normal case, since screen readers read the source text.

Interview questions

What is the difference between small-caps and all-small-caps?

'small-caps' turns only lowercase letters into small caps. 'all-small-caps' turns both lowercase and uppercase letters into small caps.

What happens if the font has no small caps?

The browser draws them by scaling capitals, unless font-synthesis disables that.

The home where you level up

Daily 3-minute lessons to understand your AI's code.

No spam — just launch news.
Unsubscribe anytime. · Privacy Policy

Analytics cookiesWe'd like to use analytics cookies to see which pages are useful. They're set only if you accept. Privacy Policy