font-variant-ligatures
Example
code {
font-feature-settings: "liga" 0, "calt" 0;
}code {
font-variant-ligatures: none;
}'none' turns off all ligatures and contextual forms without replacing other font features.
Common mistakes
- Ligatures disappear after adding
letter-spacingand it looks like a bug.
Key points
- Ligatures are turned off with
font-variant-ligatures: none, not with raw 'liga' and 'calt' tags. - Code blocks that must show exact characters disable ligatures.
- 'discretionary-ligatures' is used only on display text, not body text.
Interview questions
Why do ligatures disappear with letter-spacing?
Browsers do not apply optional ligatures when the space between characters is not zero, so letter-spacing turns them off.
What is the difference between common and discretionary ligatures?
Common ligatures like 'fi' are on by default for readability. Discretionary ones are decorative and must be turned on.