CSS font-variant-ligatures Property
The font-variant-ligatures property controls whether certain letter combinations are displayed using ligatures and contextual alternate glyphs.
Ligatures combine two or more characters into specially designed glyphs, such as the familiar fi and fl combinations. The property allows authors to enable or disable common, discretionary, and historical ligatures, as well as contextual alternates. The visible results depend on the selected font and its OpenType features.
font-variant-ligatures Syntax
The property accepts normal, none, or a combination of compatible ligature and contextual-alternate keywords.
Basic Syntax
selector {
font-variant-ligatures: normal;
}
Enable Common Ligatures
selector {
font-variant-ligatures: common-ligatures;
}
Disable Common Ligatures
selector {
font-variant-ligatures: no-common-ligatures;
}
Enable Multiple Features
selector {
font-variant-ligatures: common-ligatures discretionary-ligatures;
}
Disable Ligatures
selector {
font-variant-ligatures: none;
}
CSS-Wide Keywords
.example {
font-variant-ligatures: inherit;
}
.example {
font-variant-ligatures: initial;
}
.example {
font-variant-ligatures: unset;
}
.example {
font-variant-ligatures: revert;
}
.example {
font-variant-ligatures: revert-layer;
}
Each ligature category accepts either its enabling or disabling keyword, but not both. The normal and none values must be used alone.
Property Values
The property provides individual controls for four categories of typographic features.
| Value | Description |
|---|---|
normal |
Uses the browser's normal ligature and contextual-alternate behavior. |
none |
Disables common, discretionary, and historical ligatures, along with contextual alternates controlled by this property. |
common-ligatures |
Enables common ligatures, including standard combinations such as fi and fl. |
no-common-ligatures |
Disables common ligatures. |
discretionary-ligatures |
Enables optional decorative ligatures provided by the font. |
no-discretionary-ligatures |
Disables discretionary ligatures. |
historical-ligatures |
Enables historical ligatures associated with older typographic styles. |
no-historical-ligatures |
Disables historical ligatures. |
contextual |
Enables contextual alternate glyphs based on surrounding characters. |
no-contextual |
Disables contextual alternates controlled by this property. |
Property Characteristics
| Characteristic | Value |
|---|---|
| Initial value | normal |
| Inherited | Yes |
| Applies to | All elements and text |
| Computed value | As specified |
| Animation type | Discrete |
| Percentages | Not applicable |
These values request OpenType font features. A valid declaration may produce no visible difference if the font does not contain the corresponding glyph substitutions.
How It Works
Ligatures are special glyphs that represent combinations of characters. The browser uses the selected font's shaping information to determine whether a ligature can replace an ordinary sequence of glyphs.
Ordinary Character Sequence
The letters f and i are stored as two characters in the text.
Ligature Substitution
When a suitable font feature is enabled, the browser may display those characters using a single fi ligature glyph.
Enable a Feature
.text {
font-variant-ligatures: common-ligatures;
}
Disable a Feature
.text {
font-variant-ligatures: no-common-ligatures;
}
Multiple Feature Categories
.text {
font-variant-ligatures: common-ligatures contextual;
}
Important Consideration
Ligature substitution changes glyph presentation, not the underlying characters in the HTML. Text remains searchable and selectable as its original character sequence.
The normal Value
The normal value uses the browser's default ligature and contextual-alternate behavior.
Basic Example
.paragraph {
font-variant-ligatures: normal;
}
HTML Example
<p class="paragraph">office, affinity, and flower</p>
Default Behavior
Common ligatures are generally enabled when appropriate, while discretionary and historical ligatures are not normally enabled by default.
Reset a Custom Setting
.decorative-text {
font-variant-ligatures: discretionary-ligatures;
}
.decorative-text .regular-text {
font-variant-ligatures: normal;
}
Important Consideration
The normal value does not guarantee that ligatures will appear. The result depends on the font, text, and browser shaping behavior.
Common Ligatures
Common ligatures are standard typographic substitutions designed to improve the appearance of frequently occurring letter combinations.
Enable Common Ligatures
.text {
font-variant-ligatures: common-ligatures;
}
Disable Common Ligatures
.text {
font-variant-ligatures: no-common-ligatures;
}
HTML Example
<p class="text">office, affinity, and flower</p>
Common Letter Combinations
Typical Latin ligatures include fi, fl, ff, ffi, and ffl. Availability depends on the font.
OpenType Features
Common ligatures are associated with the OpenType liga and clig features.
Typical Uses
Common ligatures are useful in body text, headings, and other typography where the font's standard letter combinations improve visual spacing.
Important Consideration
Common ligatures are often enabled automatically. Explicitly setting common-ligatures can restore them when they have been disabled by another declaration.
Discretionary Ligatures
Discretionary ligatures are optional substitutions that provide decorative or stylistic alternatives to ordinary letter combinations.
Enable Discretionary Ligatures
.heading {
font-variant-ligatures: discretionary-ligatures;
}
Disable Discretionary Ligatures
.heading {
font-variant-ligatures: no-discretionary-ligatures;
}
HTML Example
<h2 class="heading">Creative Typography</h2>
OpenType Feature
Discretionary ligatures use the OpenType dlig feature.
Typical Uses
Discretionary ligatures are commonly used in decorative headings, logos, invitations, and display typography.
Font Availability
Many ordinary text fonts do not provide discretionary ligatures. The property may have no visible effect without a font that supports the feature.
Important Consideration
Discretionary ligatures can make text more decorative but may reduce readability when used extensively. They are generally better suited to short display text than long paragraphs.
Historical Ligatures
Historical ligatures reproduce letter combinations associated with older writing and printing traditions.
Enable Historical Ligatures
.historical-text {
font-variant-ligatures: historical-ligatures;
}
Disable Historical Ligatures
.historical-text {
font-variant-ligatures: no-historical-ligatures;
}
HTML Example
<p class="historical-text">Historical Typography</p>
OpenType Feature
Historical ligatures use the OpenType hlig feature.
Typical Uses
Historical ligatures may be useful in period-inspired designs, reproductions of historical documents, and specialized typography.
Font Availability
Historical ligatures are uncommon in standard interface fonts. They generally require a typeface designed with historical features.
Important Consideration
Use historical ligatures selectively. Some historical forms may be unfamiliar to modern readers.
Contextual Alternates
Contextual alternates change the shape of certain glyphs based on surrounding characters. These substitutions help maintain consistent spacing and letter connections.
Enable Contextual Alternates
.script-text {
font-variant-ligatures: contextual;
}
Disable Contextual Alternates
.script-text {
font-variant-ligatures: no-contextual;
}
HTML Example
<p class="script-text">Elegant Lettering</p>
OpenType Feature
Contextual alternates use the OpenType calt feature.
Typical Uses
Contextual alternates are especially useful in script fonts and other typefaces where neighboring glyphs influence the appearance of letter connections.
Important Consideration
Contextual alternates are not necessarily ligatures. They may substitute individual glyphs rather than combine several characters into one glyph.
Disabling contextual does not disable all contextual shaping required by a writing system. Mandatory shaping behavior is handled separately by the browser's text shaping engine.
The none Value
The none value disables the optional ligature and contextual-alternate features controlled by this property.
Basic Example
.text {
font-variant-ligatures: none;
}
HTML Example
<p class="text">office, affinity, and flower</p>
Equivalent Feature Controls
.text {
font-variant-ligatures: no-common-ligatures no-discretionary-ligatures no-historical-ligatures no-contextual;
}
Typical Uses
Disabling optional ligatures may be useful when individual letter shapes need to remain visually distinct or when a particular design requires ordinary glyph presentation.
Mandatory Shaping
The none value does not disable required glyph substitutions or joining behavior needed to render certain writing systems correctly.
Important Consideration
The none value does not disable every possible font feature. It affects the ligature and contextual-alternate categories controlled by font-variant-ligatures.
Combining Values
Compatible ligature and contextual-alternate keywords can be combined to control several feature categories in one declaration.
Common and Discretionary Ligatures
.heading {
font-variant-ligatures: common-ligatures discretionary-ligatures;
}
Common Ligatures and Contextual Alternates
.heading {
font-variant-ligatures: common-ligatures contextual;
}
Disable Common Ligatures but Enable Contextual Alternates
.heading {
font-variant-ligatures: no-common-ligatures contextual;
}
Enable Historical and Discretionary Ligatures
.heading {
font-variant-ligatures: historical-ligatures discretionary-ligatures;
}
Invalid Conflicting Values
.heading {
font-variant-ligatures: common-ligatures no-common-ligatures;
}
This declaration is invalid because the same feature category cannot be enabled and disabled simultaneously.
Invalid normal Combination
.heading {
font-variant-ligatures: normal discretionary-ligatures;
}
The normal keyword must be used alone.
Invalid none Combination
.heading {
font-variant-ligatures: none contextual;
}
The none keyword must also be used alone.
Font Support and OpenType Features
Ligature availability depends on the OpenType features included in the selected font.
OpenType Feature Mapping
| CSS Value | OpenType Feature |
|---|---|
common-ligatures |
liga, clig |
discretionary-ligatures |
dlig |
historical-ligatures |
hlig |
contextual |
calt |
Common Text Fonts
Many professional serif and sans-serif fonts include standard ligatures. The exact combinations vary by typeface.
Display Fonts
Decorative and script fonts may include discretionary ligatures or contextual alternates that are not found in ordinary body-text fonts.
Custom Web Fonts
.decorative-heading {
font-family: "Example Display", Georgia, serif;
font-variant-ligatures: discretionary-ligatures;
}
For predictable results, use a font with documented support for the requested OpenType feature.
Fallback Fonts
If the preferred font is unavailable, the fallback font may provide a different set of ligatures or no optional ligatures at all.
Important Consideration
Browser recognition of a ligature keyword does not guarantee that the selected font includes the corresponding glyph substitutions.
The font-variant Shorthand
The font-variant shorthand can set ligature features alongside other typographic variants.
Longhand Example
.heading {
font-variant-ligatures: common-ligatures;
}
Shorthand Example
.heading {
font-variant: common-ligatures;
}
Combining Ligatures and Small Capitals
.heading {
font-variant: common-ligatures small-caps;
}
Combining Ligatures and Numeric Features
.heading {
font-variant: discretionary-ligatures oldstyle-nums;
}
Shorthand Reset Behavior
.heading {
font-variant-ligatures: discretionary-ligatures;
font-variant: small-caps;
}
The later shorthand resets font-variant-ligatures to normal because the ligature setting is not included.
Preserving Both Features
.heading {
font-variant: discretionary-ligatures small-caps;
}
Important Consideration
Use font-variant-ligatures when changing only ligature settings. Use the shorthand when several font variant categories need to be defined together.
Using font-feature-settings
The font-feature-settings property provides direct access to OpenType feature tags.
High-Level Common Ligatures
.text {
font-variant-ligatures: common-ligatures;
}
Low-Level Common Ligatures
.text {
font-feature-settings: "liga" 1, "clig" 1;
}
High-Level Discretionary Ligatures
.text {
font-variant-ligatures: discretionary-ligatures;
}
Low-Level Discretionary Ligatures
.text {
font-feature-settings: "dlig" 1;
}
High-Level Contextual Alternates
.text {
font-variant-ligatures: contextual;
}
Low-Level Contextual Alternates
.text {
font-feature-settings: "calt" 1;
}
Preferred Approach
Use font-variant-ligatures for common typographic feature controls. Use font-feature-settings when direct control over specific OpenType tags is required.
Important Consideration
Low-level feature settings can override corresponding high-level font variant controls. Avoid conflicting declarations unless the interaction is intentional.
Ligatures and Letter Spacing
Letter spacing can influence how ligatures are rendered because ligatures combine characters into specially designed glyphs.
Normal Letter Spacing
.heading {
letter-spacing: normal;
font-variant-ligatures: common-ligatures;
}
Increased Letter Spacing
.heading {
letter-spacing: 0.15em;
font-variant-ligatures: common-ligatures;
}
Disable Ligatures for Spaced Headings
.heading {
letter-spacing: 0.15em;
font-variant-ligatures: no-common-ligatures;
}
Why Spacing Matters
When characters are spaced apart, some browsers or fonts may suppress optional ligature substitutions. Explicitly disabling common ligatures can provide more predictable results for widely spaced headings.
Important Consideration
Use letter spacing and ligatures together with care. Test the final appearance at the intended font size and across the browsers used by your audience.
Inheritance
The font-variant-ligatures property is inherited. Child elements receive the parent's ligature settings unless they specify another value.
Inherited Ligature Settings
.typography-section {
font-variant-ligatures: common-ligatures;
}
<div class="typography-section">
<h2>Creative Typography</h2>
<p>Office and affinity examples.</p>
</div>
Override a Child Element
.typography-section {
font-variant-ligatures: common-ligatures;
}
.typography-section .plain-text {
font-variant-ligatures: none;
}
Explicit Inheritance
.child {
font-variant-ligatures: inherit;
}
Reset to Initial Value
.child {
font-variant-ligatures: initial;
}
Important Consideration
Inherited ligature settings may affect headings, paragraphs, labels, and other descendant text. Apply decorative ligatures to appropriately scoped elements.
font-variant-ligatures Example
This example compares common ligatures with disabled ligatures using text that contains several typical ligature combinations.
HTML Example
<div class="font-variant-ligatures-demo">
<p class="demo-label">Common ligatures enabled</p>
<p class="ligatures-on">office affinity flower difficult</p>
<p class="demo-label">Common ligatures disabled</p>
<p class="ligatures-off">office affinity flower difficult</p>
<p class="demo-label">All optional ligatures disabled</p>
<p class="ligatures-none">office affinity flower difficult</p>
</div>
CSS Example
.font-variant-ligatures-demo {
font-family: Georgia, serif;
}
.font-variant-ligatures-demo p {
margin: 0 0 16px;
}
.font-variant-ligatures-demo .demo-label {
font: 600 13px/1.4 Arial, sans-serif;
}
.font-variant-ligatures-demo .ligatures-on,
.font-variant-ligatures-demo .ligatures-off,
.font-variant-ligatures-demo .ligatures-none {
font-size: 26px;
line-height: 1.5;
}
.font-variant-ligatures-demo .ligatures-on {
font-variant-ligatures: common-ligatures;
}
.font-variant-ligatures-demo .ligatures-off {
font-variant-ligatures: no-common-ligatures;
}
.font-variant-ligatures-demo .ligatures-none {
font-variant-ligatures: none;
}
Common ligatures enabled
office affinity flower difficult
Common ligatures disabled
office affinity flower difficult
All optional ligatures disabled
office affinity flower difficult
The first line requests common ligatures. The second disables common ligatures, while the third disables all optional ligature and contextual-alternate categories controlled by the property.
The differences may be subtle or invisible if the selected font does not contain the relevant ligature glyphs. A font with documented liga support provides a more reliable comparison.
Common Mistakes
The most common mistakes involve invalid keyword combinations, unsupported font features, and confusion about the behavior of the none value.
Combining Conflicting Values
.text {
font-variant-ligatures: common-ligatures no-common-ligatures;
}
This declaration is invalid because the same feature category cannot be enabled and disabled simultaneously.
Combining normal with Other Values
.text {
font-variant-ligatures: normal discretionary-ligatures;
}
The normal keyword must be used alone.
Combining none with Other Values
.text {
font-variant-ligatures: none contextual;
}
The none keyword must be used alone.
Using ligatures as a Value
.text {
font-variant-ligatures: ligatures;
}
This declaration is invalid. Use a supported keyword such as common-ligatures or discretionary-ligatures.
Expecting Every Font to Support Discretionary Ligatures
Many fonts do not provide the dlig feature.
Expecting none to Disable Mandatory Shaping
The none value does not disable shaping required for correct rendering of certain writing systems.
Ignoring Letter Spacing
Large letter-spacing values can affect whether optional ligatures are displayed.
Ignoring Shorthand Reset Behavior
A later font-variant declaration may reset font-variant-ligatures to normal.
Assuming Browser Support Guarantees Font Support
A browser may recognize the CSS declaration even when the selected font lacks the corresponding ligature glyphs.
Important Considerations
Keep the following points in mind when using the font-variant-ligatures property:
- Purpose: Controls optional ligatures and contextual alternates.
- Property type: Longhand of
font-variant. - Initial value:
normal. - Inheritance: The property is inherited.
- Applies to: All elements and text.
- normal: Uses normal ligature behavior.
- none: Disables optional ligatures and contextual alternates controlled by the property.
- common-ligatures: Enables common ligatures.
- no-common-ligatures: Disables common ligatures.
- discretionary-ligatures: Enables optional decorative ligatures.
- no-discretionary-ligatures: Disables discretionary ligatures.
- historical-ligatures: Enables historical ligatures.
- no-historical-ligatures: Disables historical ligatures.
- contextual: Enables contextual alternates.
- no-contextual: Disables contextual alternates.
- Compatible combinations: Different feature categories may be combined.
- Conflicting values: Enabling and disabling the same category together is invalid.
- OpenType: The selected font must support the requested features.
- Text content: Ligature substitution does not change the underlying characters.
- Letter spacing: Spacing adjustments may influence optional ligature rendering.
- Shorthand reset: A later
font-variantdeclaration may reset the property. - Readability: Use decorative and historical ligatures selectively.
- Browser support: Check compatibility and font feature availability.
Use font-variant-ligatures to fine-tune letter combinations without changing the underlying text. For consistent results, select a font with the required OpenType features and test the typography at its intended size.
Browser Support
The CSS font-variant-ligatures property is Widely available in modern browsers, including Chrome, Edge, Firefox, and Safari.
Support for individual ligature features and their visible results depends on the browser's text shaping capabilities and the selected font's OpenType features.
Basic Example
.text {
font-variant-ligatures: common-ligatures;
}
Feature Detection
@supports (font-variant-ligatures: discretionary-ligatures) {
.heading {
font-variant-ligatures: discretionary-ligatures;
}
}
Progressive Enhancement
.heading {
font-variant-ligatures: normal;
}
@supports (font-variant-ligatures: discretionary-ligatures) {
.heading {
font-variant-ligatures: discretionary-ligatures;
}
}
Font Feature Availability
The @supports rule checks whether the browser recognizes the CSS declaration. It does not confirm that the selected font provides the requested ligature glyphs.
For current compatibility information, visit Can I Use? and search for font-variant-ligatures.
Specifications
The font-variant-ligatures property is defined in the CSS Fonts Module, which describes ligature and contextual-alternate controls and their relationships to OpenType features.
CSS Fonts Module Level 4: font-variant-ligatures
The module also defines the font-variant shorthand and other typographic feature controls.
For additional explanations and examples, see MDN Web Docs.
