OpenType Features: font-variant, Numerals, Ligatures and font-feature-settings
Using the extra glyphs inside fonts: tabular and old-style numerals, fractions and slashed zeros, ligatures, real small caps, superscripts, stylistic alternates with @font-feature-values, emoji presentation, kerning and font-feature-settings.
kvi5hnuCode Sprout team member7 min readOn this page
Professional fonts contain much more than one glyph per character: digits in several styles, real small capitals, ligatures, fractions, swashes and alternate letter shapes. These are OpenType features, switched on by four-letter tags. CSS exposes the common ones through the font-variant-* properties, and all of them through font-feature-settings.
A feature only does something if the font has it. Test with the fonts you actually use.
Numerals: font-variant-numeric

| Value | Feature | Effect |
|---|---|---|
lining-nums | lnum | digits at capital height, on the baseline |
oldstyle-nums | onum | digits that rise and fall like lowercase, blending into text |
proportional-nums | pnum | each digit its own width |
tabular-nums | tnum | all digits the same width, so columns line up |
diagonal-fractions, stacked-fractions | frac, afrc | 1/2 drawn as a fraction |
ordinal | ordn | 1st, 2nd with raised letters |
slashed-zero | zero | a zero with a slash, distinct from O |
Values from different groups combine: font-variant-numeric: tabular-nums lining-nums slashed-zero. Two from the same group can't: tested in Chrome, tabular-nums proportional-nums is invalid.
Tabular numbers are the one to remember: use them wherever digits must line up, or must not jiggle as they change, like tables, prices, timers and counters.
td.num, .price, .timer { font-variant-numeric: tabular-nums; }
Tested in Chrome with the macOS system font at 40px: "1111" was 72.4px with proportional-nums and 98.2px with tabular-nums, and 1/2 with diagonal-fractions shrank from 52.7px to 29.9px as it became a single fraction. With Georgia, none of these changed anything, because Georgia has old-style proportional digits only.

Every panel depends on the font: the same declarations do nothing when a font lacks the feature, as Georgia shows for numerals.
Ligatures: font-variant-ligatures
A ligature joins letters that collide, like "fi" or "ffl", into one glyph.
| Value | Feature | Default |
|---|---|---|
common-ligatures / no-common-ligatures | liga, clig | on |
discretionary-ligatures | dlig | off: decorative joins like "ct" |
historical-ligatures | hlig | off |
contextual / no-contextual | calt | on: alternates that depend on neighbours |
none | all off |
Tested in Chrome with Baskerville at 40px: "office" was 85.8px normally and 86.7px with font-variant-ligatures: none, as the "ffi" ligature split into three letters. Turn ligatures off for code, where fi should stay two characters, and for widely letter-spaced text: browsers disable common ligatures when letter-spacing is not zero anyway. Tested in Chrome: with letter-spacing: 0.1px, "office" was 87.3px, the width with ligatures off plus the 0.6px of added spacing, so the ligature was gone.
Programming fonts often use contextual alternates for => and !== arrows; font-variant-ligatures: none or no-contextual turns those off for readers who prefer the plain characters.
Capitals: font-variant-caps
| Value | Effect |
|---|---|
small-caps | lowercase letters as small capitals (smcp) |
all-small-caps | capitals and lowercase as small capitals (c2sc and smcp), for acronyms |
petite-caps, all-petite-caps | smaller still, if the font has them |
unicase | a mix of small and full capitals |
titling-caps | capitals designed for large sizes |
Real small capitals are designed to match the weight of the text. If the font has none, the browser synthesizes them by shrinking full capitals, which makes them look too thin; font-synthesis-small-caps: none prevents that (article 85).
abbr { font-variant-caps: all-small-caps; letter-spacing: 0.04em; }
Position: font-variant-position
sub and super use the font's designed subscript and superscript glyphs (subs, sups), which keep the line height even. The <sub> and <sup> elements instead shrink the text and use vertical-align, which can push lines apart (article 93). Chrome 117 and later support it, but if the font lacks the glyphs, nothing changes, so it's not a reliable replacement.
Alternates and @font-feature-values
Some fonts include stylistic sets (ss01 to ss20), swashes, and other alternates, which the font names by number. @font-feature-values gives them readable names for one family, and font-variant-alternates uses them:
@font-feature-values "Brand Serif" {
@styleset { alt-a: 1; round-dots: 4; }
@swash { fancy: 1; }
}
h1 { font-family: "Brand Serif", serif; font-variant-alternates: styleset(alt-a, round-dots) swash(fancy); }
This works in all browsers since Chrome 111. The font's documentation lists which sets exist and what they change.
Emoji presentation: font-variant-emoji
Some characters, like ❤ or ☎, can be drawn as a colorful emoji or as a plain text symbol. font-variant-emoji: text asks for the text form, emoji for the color form, and unicode follows the Unicode default. Chrome 131 and Firefox 141 support it; Safari doesn't yet.
Kerning and East Asian forms
font-kerning:auto(the default),normalornone. Kerning adjusts the space between specific pairs, like "AV". Browsers kern by default; leave it on.font-variant-east-asian:jis78tojis04,simplified,traditional,full-width,proportional-widthandrubyglyph variants for Chinese and Japanese text.font-language-overrideforces a language's glyph forms regardless oflang: Firefox and Chrome 143.
The font-variant shorthand
font-variant sets all the font-variant-* properties:
.figure-caption { font-variant: small-caps tabular-nums; }
In the font shorthand (article 88), only normal and small-caps are allowed for the variant.
font-feature-settings: the low-level switch
font-feature-settings turns on any feature by its tag:
.code { font-feature-settings: "zero", "ss02"; } /* slashed zero, stylistic set 2 */
.price { font-feature-settings: "tnum" 1, "lnum" 1; }
.text { font-feature-settings: "liga" 0; } /* 0 turns a feature off */
Tags must be quoted: tested in Chrome, font-feature-settings: tnum is invalid, while "tnum" 1 is valid and serializes as "tnum", since 1 is the default.
Prefer font-variant-* where possible, because font-feature-settings has a pitfall: it's one property, so a later declaration replaces the whole list, not just one feature:
body { font-feature-settings: "kern", "liga", "ss01"; }
.price { font-feature-settings: "tnum"; } /* ss01 is now off on prices */
The font-variant-* properties are separate and inherit independently, so they combine as you'd expect. Use font-feature-settings only for features without a font-variant value, like stylistic sets (if you don't use @font-feature-values), and consider setting them through custom properties so they can be combined.
body { font: 0.85rem system-ui, sans-serif; margin: 1rem; }
label { display: block; }
table { margin-top: 0.6rem; border-collapse: collapse; font-size: 1.15rem; }
td { padding: 0.2rem 0.6rem; border-block-end: 1px solid #e8dccb; }
td.n { text-align: end; }
.note { color: #555; font-size: 0.8rem; }
With tabular numbers the decimals line up; with fractions 1/2 becomes ½. On systems whose interface font lacks a feature, that checkbox has no effect, which is exactly the point about features depending on the font.
What's current
- All
font-variant-*properties and@font-feature-values: all browsers (font-variant-positionsince Chrome 117). font-variant-emoji: Chrome and Firefox.font-feature-settingsandfont-variation-settingscan also be set inside@font-face(article 83).
Common questions
Why doesn't tabular-nums change anything?
The font doesn't include tabular figures, or its default digits are already tabular. Check with another font.
Should I use font-feature-settings or font-variant?
font-variant-* whenever a value exists, because they combine and inherit separately. font-feature-settings replaces its whole list each time.
Why are my small caps thin?
The font has no real small caps, so the browser shrinks capitals. Use a font with smcp, or avoid small caps.
How do I stop "fi" becoming one glyph in code?
font-variant-ligatures: none.
Summary
- OpenType features add alternate glyphs; they only work if the font has them.
font-variant-numeric:tabular-numsfor aligned digits,oldstyle-numsfor text, fractions, ordinals andslashed-zero.font-variant-ligatures,-caps,-position,-alternates(with@font-feature-values),-east-asianand-emojicover the other common features.font-feature-settingsswitches any feature by quoted tag, but replaces its whole value; preferfont-variant-*.
Practice questions
Write CSS that makes prices in a table line up and shows zeros with a slash.
Answer
td.price { font-variant-numeric: tabular-nums slashed-zero; }
After these rules, which features are on for .price elements?
body { font-feature-settings: "ss01", "liga"; }
.price { font-feature-settings: "tnum"; }
Answer
Only tnum (plus the browser defaults like common ligatures and kerning, which are on unless turned off). The second declaration replaces the whole list, so ss01 is off on prices.
Why is this declaration invalid?
.n { font-variant-numeric: tabular-nums proportional-nums; }
Answer
Both values are in the same group, numeral spacing, and only one per group is allowed.
Why might font-variant-caps: small-caps produce small capitals that look too light?
Answer
The font has no small-cap glyphs, so the browser synthesizes them by scaling down full capitals, which also scales down their stroke weight.
Previous: Font Size, Weight, Style, Stretch and Synthesis
Next: Variable Fonts: Axes, font-variation-settings and Optical Sizing

More in CSS Course
Quiz: CSS Delicate Details
Twenty-five questions on the edge cases that surprise experienced developers: invalid custom properties, shorthands that reset values, layer order with !important, containing blocks, margin collapsing, specificity of :is() and :where(), intrinsic minimum sizes, and more, each checked in Chrome.
Quiz: CSS Interview Questions
Thirty front-end interview questions: cascade, specificity and layers, box model and margin collapsing, stacking contexts, positioning, flexbox and grid, responsive design, custom properties, performance, accessibility, modern selectors and architecture.
Quiz: CSS Course Final Exam
Thirty questions across the whole CSS course: syntax and error handling, selectors, the cascade and layers, values and units, color, the box model, backgrounds, positioning, flexbox, grid, responsive design, typography, generated content, effects, transforms, motion and architecture.
Quiz: CSS Architecture, Tooling and Debugging (CSS Part 17)
Twenty questions on modular CSS and BEM, layering a stylesheet, design tokens and theming, pattern libraries and safe refactoring, preprocessors and build tools, the at-rules reference, and debugging common CSS problems.
Discussion
Sign in to ask a question or share what you learned.