Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

font-variant-alternates — alternate glyphs

The font-variant-alternates property selects alternate glyphs available in a font without changing the text's characters.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

font-variant-alternates: normal | [ 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>) ];

font-variant-alternates is inherited; its initial normal enables none of these alternates. historical-forms selects historical forms.

Functions select variants: stylistic() — stylistic alternates, styleset() — stylistic sets, character-variant() — character variants, swash() — swashes, ornaments() — ornaments, annotation() — annotation forms. They accept names from @font-feature-values, not direct numeric indexes.

|| allows different components in any order; # denotes a comma-separated list. normal stands alone. Undefined names and font-unsupported variants do not affect glyph selection. A valid computed value does not guarantee a visible change.

Examples

<!doctype html>
<meta charset="utf-8">
<title>font-variant-alternates</title>
<style>
  #sample { font-variant-alternates: historical-forms; }
  #sample span { font-variant-alternates: normal; }
</style>
<p id="sample">Sample <span>Sample</span></p>
<pre id="result"></pre>
<script>
  const sample = document.getElementById('sample');
  const child = sample.querySelector('span');
  document.getElementById('result').textContent = [
    getComputedStyle(sample).fontVariantAlternates,
    getComputedStyle(child).fontVariantAlternates
  ].join('\n');
</script>

Result

historical-forms
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.

Sources