Font-variant-ligatures - CSS Property

font-variant-ligatures

Summary of characteristics of the font-variant-ligatures property

Quick description
Enables or disables character ligation.
Status
Standard
Predefined values
normal | none | common-ligatures | no-common-ligatures | historical-ligatures | no-historical-ligatures | discretionary-ligatures | no-discretionary-ligatures | contextual | no-contextual
Percentages
Not applicable.
Initial value
normal
Inherited by default
Yes.
Discrète: during an animation, the font-variant-ligatures property passes from one value to another without transition.
Per grammar: serialization in the order of syntax.
W3C Module
CSS Fonts Module
 🡇  
 🡅  
Document status: WD (Working Draft)

Document status: REC (Recommendation)

Syntax diagram of font-variant-ligatures.

Font-variant-ligatures property - Syntax diagramSyntax diagram of the font-variant-ligatures CSS property. See stylescss.free.fr for details. normal normal none none common-ligatures common-ligatures no-common-ligatures no-common-ligatures discretionary-ligatures discretionary-ligatures no-discretionary-ligatures no-discretionary-ligatures historical-ligatures historical-ligatures no-historical-ligatures no-historical-ligatures contextual contextual no-contextual no-contextualfont-variant-ligatures:;font-variant-ligatures:;
Syntax diagram of the font-variant-ligatures property.
The links in the diagram provide more details about the values.
Download the diagram.

Description of the font-variant-ligatures property.

font-variant-ligatures allows you to turn character ligatures on or off, that is, the fact that some letters, when they come one after another, can be connected to each other or even form a new letter. Here are the most common ligatures:

Examples of ligatures

The main ligature characters exist in the Unicode set, but they aren’t directly available on the keyboard: you need to know their code (or the HTML entity to use them). OTF fonts offer the possibility to automatically replace certain letter pairs with the corresponding ligature. It’s obviously much easier for writers, who can just type their text without getting into computer coding.

font-variant-ligatures is the easiest property to use, but you can also check out shorthand property font-variant, which lets you enable or disable multiple OTF font options in a single line.
As for font-feature-settings , it's a much more complex property to use, but it allows low-level control over all the possibilities of OTF fonts.

Quelques précisions sur les ligatures.

So, a ligature basically means replacing a pair of letters with another character, which is more aesthetic or easier to read. The Unicode character set includes many ligatured letters like œ, æ, fi, etc. But for the replacement to be automatic (which font-variant-ligatures claims to do), the font also needs to have a substitution table so that browsers know what to replace the letter pairs with.

Of course, the author of the page always has the option to use The entities to enforce the characters of their choice, but browsers can now take on that job themselves.

Ligatures are typographical subtleties: we could just ignore them. But reading tablets and e-books are becoming more and more common: Amazon's Kindle, Kobo, PocketBook, etc. It would be a shame if these e-books performed worse than their predecessors, the paper books.

Several types of ligatures.

Spelling ligatures.

Not using these ligatures is considered a spelling mistake. Spell checkers actually flag these omissions. In French, it's mainly the two characters œ and æ, which also exist in uppercase Œ and Æ. Other languages also have their own orthographic ligatures like ß in German.

Aesthetic ligatures (common-ligatures).

Some letters, when they come together, have shapes that overlap or create a result that looks a bit off to purists. This is especially the case with serif fonts like 'Times New Roman'. For example, an f followed by an i makes the dot on the i collide with the loop of the f. You can conveniently replace these two letters with the fi character.

Another ligature is very commonly used, the one that consists of replacing the letters e and t with &.

fi => fi     et => &

Optional ligatures (discretionary-ligatures).

Font designers sometimes change the shape of certain characters when they come before or after another character. This is to even out the spacing between each character, or just for aesthetic reasons.

ct => Ligature ct     st => Ligature st

Historical ligatures (historical-ligatures).

They've kind of fallen into oblivion, but it can be interesting to bring them back to create a vintage typography effect. Unfortunately, very few fonts include these characters.

Contextual ligatures (contextual).

Finally, CSS talks to us about contextual ligatures. They aren't really ligatures: it actually refers to replacing certain character glyphs with others that are more aesthetic, more decorative, or just different. These replacements can happen only in certain cases, like when the character is the first or last in a word.

Values for font-variant-ligatures.

The font used for the examples and the simulator is the Kleymissky font (copyright gluk).

  • font-variant-ligatures: normal;

    Default value. The characters are rendered as they are defined by default in the font. Some ligatures are used, others are not. In general, this value is equivalent to common-ligatures and contextual.

    Difficult
    Font Kleymissky
    normal
  • font-variant-ligatures: none;

    No ligature is used.

    Difficult
    Font Kleymissky
    none
  • font-variant-ligatures: common-ligatures; font-variant-ligatures: no-common-ligatures;

    Turning common ligatures on or off: for example fi => fi

    Matches the OTF styles liga and clig. Refer to the font-feature-settings property for a more complete description of what OpenType fonts can do.

    For OTF (Open Type Font) fonts, this option is enabled by default.

    In the examples below, you can clearly see the dots on the i hitting the loop of the f when common ligatures are turned off. When you enable these ligatures, the dots and loops merge. Similarly, the two fs in 'difficult' are identical without ligatures, but with ligatures, the second f is bigger.

    Difficult, final
    Font Kleymissky
    common-ligatures
    Difficult, final
    Font Kleymissky
    no-common-ligatures
  • font-variant-ligatures: discretionary-ligatures; font-variant-ligatures: no-discretionary-ligatures;

    Turning on or off the ligatures specific to the font being used. The font designer is free to choose which discretionary ligatures they want to include. So you'll need to check the font's documentation to find out.

    Corresponds to the OTF style dlig.

    Test Tact
    Font Warnock
    discretionary-ligatures
    Test Tact
    Font Warnock
    no-discretionary-ligatures
  • font-variant-ligatures: historical-ligatures; font-variant-ligatures: no-historical-ligatures;

    Turning ligatures on or off as they were used in mechanical printing.

    Corresponds to the OTF style hlig.

  • font-variant-ligatures: contextual; font-variant-ligatures: no-contextual;

    Turning contextual ligatures on or off. It's not really about ligatures per se, but more about different forms for certain characters depending on the characters that come before or after. On OTF fonts, this option is turned on by default.

    For example, below, many characters are different.

    Corresponds to the OTF style calt.

    Make Love
    Not War
    Font Kleymissky
    contextual
    Make Love
    Not War
    Font Kleymissky
    no-contextual
  • font-variant-ligatures: initial; (normal) font-variant-ligatures: inherit; font-variant-ligatures: revert; font-variant-ligatures: revert-layer; font-variant-ligatures: revert-rule; font-variant-ligatures: unset;

    Links to the presentation of these different values: initial, inherit, revert, revert-layer, revert-rule, unset.

Animation of the font-variant-ligatures property.

The three animations below really highlight the differences in behavior of each font. And consequently, the difficulty of handling ligatures any way other than in a way specific to the font being used.

  • Kleymissky does add a ligature between the f and the i, but it also adds loops on the first and last letters of each word. Which should be included in the contextual-ligatures.
  • Warnock also applies ligatures to the letter pairs st and ct. Which other fonts don’t do.
  • As for Comic Jens, it's a humorous font with some very specific ligatures: you can see the three letters LOL, in uppercase or lowercase, turn into a new symbol.
Test tact
end effect


Kleymissky
Test tact
end effect

Warnock

LOL lol


Comic Jens

Simulator.

The effect of the font-variant-ligatures property really depends on the font you use. Pay special attention to the character pairs fi and ff, which are the ones most often handled.


Police :

font-variant-ligatures :

The ligature is indeed a subtle aesthetic finish.
fi   ff   tf   ft   jf   fj   fz   ct   st

Browsers compatibility with font-variant-ligatures.

The font-variant-ligatures property is well recognized by current browsers, but you should keep in mind that its effect is very dependent on the font used.

Column 1
Browser support for the font-variant-ligatures property, which defines whether ligatures should be rendered, and which ligatures (common, historical, contextual, etc.).
1
font-variant-ligatures
property
Estimated overall support.
97%

Browsers on computers :

Mobile browsers :

Outdated or marginal browsers :

Internet Explorer

UC Browser pour Androïd

Opéra Mobile

QQ Browser

Baidu Browser

Samsung Internet

Safari

Safari sur IOS

Chrome

Edge

Firefox

Opéra

Chrome pour Androïd

Androïd Brower

Firefox pour Androïd

KaiOS Browser

Opéra mini

Historic of the font-variant-ligatures property.

  • CSS Fonts Module Level 3

    This specification concerns fonts. A font contains the visual representation of characters. In its simplest form, it is just a matter of associating character codes with their shapes.
    Within a typeface family, the shapes are defined but can vary in stroke thickness, slant, width, etc. The CSS properties font-... allow choosing the final appearance of the characters.
    Fonts can be located on the user's computer or downloaded.

    Regarding font-variant-ligatures:
    First definition of the font-variant-ligatures property.
    WD
    July 21, 1997
    Working Draft.
    CR
    October 03, 2013
    Candidate Recommendation.
    PR
    August 14, 2018
    Proposed for recommendation.
    REC
    September 20, 2018
    Recommendation .
  • CSS Fonts Module Level 4

    This level 4 of the specification on fonts reprises what is defined in level 3. It adds the possibility to define what happens when a font takes a long time to load or is missing. It also adds support for colored fonts and clarifies many points still poorly defined in level 3.

    Regarding font-variant-ligatures:
    No change regarding the definition of the font-variant-ligatures property.
    WD
    July 11, 2017
    Working Draft.
    CR
    PR
    REC
  • CSS Fonts Module Level 5

    Regarding font-variant-ligatures:
    No change to the font-variant-ligatures property.
    WD
    June 29, 2021
    Working Draft.
    CR
    PR
    REC

See also, about fonts.

The CSS Fonts Module specification covers everything related to fonts: typography, using the features of modern font formats, downloading fonts, and so on.

Properties:

font
Langue française
Shorthand to set most properties for fonts.
✗
font-effect
Langue française
Allows you to apply some effects to the text: relief, border...
font-family
Selects a font from those that are available or downloaded.
⚠
font-feature-settings
Langue française
Permet d’exploiter les fonctionnalités spécifiques des polices de caractères OTF, WOFF, etc.
font-kerning
Adjusting the kerning between characters.
⚠
font-language-override
Langue française
Defines the language to be considered when choosing characters.
⚠
font-optical-sizing
Langue française
Optimizes the shape of characters based on their size.
font-palette
Langue française
Defines the color palette that can be used for colored fonts.
font-size
Adjusts the font size, which also impacts units like em, ex, etc.
font-size-adjust
Langue française
Definition of the aspect factor of the font.
✗
font-smooth
Langue française
Defines whether and which smoothing algorithm should be used.
font-stretch
Langue française
Changes the stretching or compression of characters.
font-style
Langue française
Selects the italic or oblique font styles.
font-synthesis
Allows or disallows calculation of missing styles in the typeface.
⚠
font-synthesis-position
Langue française
Whether or not allows the browser to synthesize characters in superscript or subscript.
font-synthesis-small-caps
Langue française
Whether or not allows the browser to calculate the glyphs of characters in small caps.
font-synthesis-style
Langue française
Defines whether the browser is allowed to synthesize italic forms of characters.
font-synthesis-weight
Langue française
Defines whether or not the browser can calculate the bold glyph.
font-variant
Shorthand to define advanced typographic attributes: ligatures, character substitution, etc.
font-variant-alternates
Defines character substitution (OTF, WOFF fonts).
font-variant-caps
Applies character capitalization.
font-variant-east-asian
Typography specific to Chinese or Japanese characters.
⚠
font-variant-emoji
Choose between an emoji or text presentation.
Font-variant-ligatures
Enables or disables character ligation.
font-variant-numeric
Defines how evolved numbers are displayed: fractions, numbers, etc.
⚠
font-variant-position
Superscript or subscript of characters.
font-variation-settings
Provides access to the stylistic possibilities of OTF fonts.
font-weight
Selects a weight for the characters.
font-width
Langue française
Synonymous with font-stretch (character width/enlargement).

Functions:

⚠
palette-mix()
Langue française
Establish the mixture of two color palettes from two different typefaces.

At-rules:

@font-face
Langue française
Defines all settings for a downloadable font.
⚠
@font-feature-values
Langue française
Defines the typographic variations to use.
@font-palette-values
Langue française
Defines a color palette that can then be applied to a font.

Descriptors :

ascent-override
Langue française
Descriptor for @font-face. Sets the height of the characters above the baseline.
descent-override
Langue française
Descriptor for @font-face. Sets the height of the characters below the baseline.
⚠
font-display
Langue française
Descriptor for @font-face. Determines how the browser behaves when faced with fonts that take a long time to load.
line-gap-override
Langue française
Descriptor for @font-face. Sets the line spacing of the font.
src
Langue française
Defines the source of a font file to download, or an image to display.
unicode-range
Langue française
Descriptor for @font-face. Defines the range of character codes to be downloaded into a font.