CSS Reference ยท Typography
The font-variant-ligatures property
Reference for the CSS font-variant-ligatures property: common, discretionary, historical and contextual ligatures, how to turn them off, with live examples.
A ligature merges two or more letters into one glyph, such as the joined "fi" in many serif fonts. The font-variant-ligatures property turns the different kinds of ligatures on or off.
Common ligatures are enabled by default, so you normally see them without writing any CSS. You reach for this property to switch them off (for code, form fields or spaced-out text) or to enable decorative ones the font offers.
code { font-variant-ligatures: none; } .fancy { font-variant-ligatures: common-ligatures discretionary-ligatures; }
Try it
Compare the first two lines around "fi" and "fl". Which fonts have ligatures varies, so the difference may be small. Adding letter-spacing also switches common ligatures off, which is why the third line matches the second.
Syntax
font-variant-ligatures: normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> ]; /* <common-lig-values> = common-ligatures | no-common-ligatures */ /* <discretionary-lig-values> = discretionary-ligatures | no-discretionary-ligatures */ /* <historical-lig-values> = historical-ligatures | no-historical-ligatures */ /* <contextual-alt-values> = contextual | no-contextual */
| Initial value | normal |
| Applies to | All elements and text |
| Inherited | Yes |
| Animatable | No |
| Computed value | As specified |
Values
| Value | Description |
|---|---|
normal |
The browser's default: common ligatures and contextual alternates on, others off. |
none |
Disables all ligatures. |
common-ligatures / no-common-ligatures |
Standard ligatures such as fi, fl and ff. |
discretionary-ligatures / no-discretionary-ligatures |
Decorative ligatures chosen by the font designer. Off by default. |
historical-ligatures / no-historical-ligatures |
Old forms such as the long s. Off by default. |
contextual / no-contextual |
Context-dependent alternates, such as code fonts that merge => or !=. |
Usage notes
- Letter-spacing. When
letter-spacingis not zero, browsers turn optional ligatures off so the added space does not split a joined glyph. Do not try to force them back on. - Code fonts. Programming fonts with ligatures for
->or==rely on thecontextual(or common) setting. Turn it off withfont-variant-ligatures: noneif learners should see the plain characters. - Searching and copying. Ligatures are display-only; copied text and search results still use the original letters.
- Form fields and inputs. Disable ligatures where exact characters matter, such as ID or serial-number displays.
- Lower-level alternative.
font-feature-settings: "liga" 0also works but overrides other settings; seefont-feature-settings. - Shorthand reset. A later
font-variantdeclaration resets this property tonormal.
Browser support
Supported in all current browsers; the visible effect depends on whether the font contains ligature glyphs.