font-variant-caps
Example
abbr {
text-transform: uppercase;
font-size: 0.8em;
}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, nottext-transform: uppercasewith 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.
