CSS Reference ยท Typography
The font-feature-settings property
Reference for the CSS font-feature-settings property: four-letter OpenType feature tags, on/off values, stylistic sets, pitfalls and live examples.
The font-feature-settings property switches individual OpenType features on or off using their four-letter tags, such as liga (ligatures), tnum (tabular numbers) or ss01 (stylistic set 1). It is the low-level tool behind the friendlier font-variant-* properties.
Use it when a font has a feature that no named property covers, such as a stylistic set or character variant. For everything else, prefer the font-variant-* properties: they are easier to read, they cascade independently and they do not wipe each other out.
.code { font-feature-settings: "liga" 0, "zero" 1; } .display { font-feature-settings: "ss01"; }
Try it
Each setting changes the text only when the font includes that feature; otherwise it is silently ignored.
Syntax
font-feature-settings: normal | <feature-tag-value>#; /* <feature-tag-value> = <string> [ <integer> | on | off ]? */
| Initial value | normal |
| Applies to | All elements and text |
| Inherited | Yes |
| Animatable | No |
| Computed value | As specified |
Values
| Value | Description |
|---|---|
normal |
No explicit feature settings; the browser's defaults apply. |
"tag" |
A four-character feature tag in quotes. Without a number it means on (1). |
"tag" 1 or "tag" on |
Turns the feature on. |
"tag" 0 or "tag" off |
Turns the feature off. |
"tag" n |
For features with several alternatives (such as salt or cv01), picks the nth alternative. |
Separate several settings with commas.
Usage notes
- Tags are quoted.
"liga"needs quotes;ligaalone is invalid. Tags are case-sensitive. - It overrides, not merges. The whole value replaces the inherited one. A child with
"tnum"loses the parent's"zero"unless you repeat it. - Prefer named properties.
font-variant-numeric: tabular-numsis clearer than"tnum"and works well with the cascade; seefont-variant-numeric,font-variant-ligaturesandfont-variant-caps. - Precedence.
font-feature-settingsis applied after the other font variant properties, so it wins when they conflict. - Stylistic sets. Features like
ss01toss20andcv01tocv99are unique to each font. Read the font's documentation to learn what they do. - Fallback fonts. If the primary font is missing, the same tags are sent to the fallback font, where they may mean something different or nothing.
- Hidden state. Hand-written feature strings are hard to review, so comment which feature a tag turns on.
Browser support
Supported in all current browsers; the result depends on the features in the chosen font.