CKTIS / CSS
font-variant — typographic variants shorthand
font-variant sets typographic variants such as small capitals, ligatures, and tabular figures. As a shorthand, it also resets omitted component properties.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
font-variant: normal;
font-variant: none;
font-variant: small-caps lining-nums tabular-nums;
font-variant: inherit;font-variant is a shorthand covering font-variant-ligatures, font-variant-position, font-variant-caps, font-variant-numeric, font-variant-alternates, font-variant-east-asian, and, in Level 4, font-variant-emoji. Settings are inherited; visible effects depend on the font and browser support.
Compatible values can be combined with spaces, for example small-caps tabular-nums. normal restores every component's initial value. none sets font-variant-ligatures: none and restores the other components to their initial values. It does not mean disabling every font feature.
Every shorthand declaration resets omitted components. Consequently, the example replaces the earlier oldstyle-nums with normal. To change just one aspect without resetting the others, use its component property. The shorthand does not reset font-feature-settings, font-variation-settings, or font-language-override.
The Level 4 definition does not guarantee support for every value in the target browser. The example checks computed values rather than glyph appearance.
Examples
<!doctype html>
<meta charset="utf-8">
<title>font-variant</title>
<style>
#sample {
font-variant-numeric: oldstyle-nums;
font-variant: small-caps;
}
</style>
<p id="sample">Example 123</p>
<pre id="result"></pre>
<script>
const sample = document.getElementById('sample');
const style = getComputedStyle(sample);
document.getElementById('result').textContent =
style.fontVariantCaps + '\n' + style.fontVariantNumeric;
</script>Result
small-caps normal
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.