Using small caps with CSS font-variant
The CSS font-variant property controls alternate forms of a typeface. A common use is small caps:
p {
font-variant: small-caps;
}
This does not simply make lowercase letters smaller. When the selected font includes real small-cap glyphs, the browser can use those instead. Otherwise, it may simulate the effect.
For the basic form of the property, the useful values are:
normaluses the font’s normal glyphs and is the default.small-capsdisplays lowercase text as small capital letters.initialresets the property to its initial value.inherittakes the value from the parent element.
font-variant is a shorthand for several more specific properties, but for a simple small-caps treatment, this is all you need. Just check the result with the actual font you plan to use—the quality depends on the typeface.
Enjoyed reading this?
If you found this article helpful, consider supporting my writing. Every little bit helps keep this blog going.
Related articles
- Better Line Breaks With CSS balance and pretty
Use text-wrap balance for short headings and text-wrap pretty selectively for longer copy without hard-coded line breaks.
- Why 100vh Doesn’t Always Fit a Mobile Screen
Choose svh, lvh, dvh, or a flexible min-height when mobile browser controls make 100vh an awkward fit.
- Making Links Easy to Recognize
Make links recognisable with underlines, clear focus states, useful text, and behaviour that does not surprise the reader.