How to Use OpenType Features in CSS
Enable ligatures, tabular figures, small caps and stylistic sets in CSS, and check what your font file really supports. Measured on this site's own DM Sans: ligatures were already on, tabular-nums did nothing (no tnum table), and only font-variant-caps produced small caps.
What OpenType Features Are
A font can carry alternative glyphs and rules, each switched by a four-letter tag: liga (standard ligatures such as fi and ffl), kern (kerning), tnum (tabular figures, all digits the same width), onum (oldstyle figures), smcp (small capitals), frac (fractions), ss01-ss20 (stylistic sets) and many more. Some are on by default in browsers (kern, liga, calt and the mark-positioning features); the rest you switch on.
Switching Them On in CSS
.table { font-variant-numeric: tabular-nums; }
.abbr { font-variant-caps: all-small-caps; }
.title { font-variant-ligatures: discretionary-ligatures; }
.alt { font-feature-settings: "ss01" 1; } /* only when no font-variant-* keyword exists */
Prefer the font-variant-* properties: they cascade independently and, for small caps, let the browser synthesise them if the font has none. font-feature-settings is a single property, so setting it on a child replaces every feature set on the parent.
Measured: What Our Own Font Supports
This site serves DM Sans, JetBrains Mono and Chakra Petch from the files Google Fonts delivers. We listed their OpenType tables with fontTools and then tested the features in Chromium with DM Sans at 48px (October 14, 2026; results in our test folder):
| Font file (Latin subset) | Features present |
|---|---|
| DM Sans | calt, ccmp, dnom, frac, kern, liga, locl, mark, mkmk, numr |
| JetBrains Mono | calt, ccmp, frac, locl, mark |
| Chakra Petch | ccmp, frac, kern, liga, locl, mark, mkmk |
| Test | Result |
|---|---|
"office affine" default vs font-variant-ligatures: none | 262px vs 264px: ligatures were already on |
| "1111" vs "0000" | 60px vs 132px: proportional digits |
The same with tabular-nums | 60px vs 132px: no change, the file has no tnum |
"Html Css" with font-variant-caps: small-caps | 201px → 186px: browser-synthesised small caps |
The same with font-feature-settings: "smcp" 1 | 201px: no change, nothing to switch on |
Two practical lessons. First, a feature you enable is silently ignored when the font lacks it, so tabular-nums on a DM Sans price table does not line the digits up: check the font, or set number columns in a font that has tnum (JetBrains Mono, being monospaced, aligns anyway). Second, for small caps use font-variant-caps, which falls back to synthesised capitals, rather than the smcp tag, which does nothing without real small-cap glyphs. Synthesised small caps are scaled-down capitals and look lighter than true ones.
Checking a Font Before You Rely on It
- Wakamai Fondue (wakamaifondue.com) lists a font file's features and generates the CSS.
- fontTools:
ttx -t GSUB font.woff2dumps the substitution features. - Web-font services can subset files; the copy you serve may have fewer features than the family's full release, as the table above shows for DM Sans.
