This property gives us control over advanced typographic settings such as small caps, ligatures, and swashes. To activate them you must declare which value you need in quotes and then followed by either 1
or on
to enable. Alternatively, you can disable them with either 0
or off
:
.element {
/* these two values do the same thing */
font-feature-settings: "liga" 1;
font-feature-settings: "liga1" on;
}
Many other values, besides standard ligatures are supported by the font-feature-settings
property, including small caps:
.element {
font-feature-settings: "smcp" 1;
}
Values
This is a list of every value that is supported by font-feature-settings
, but make sure to check the web font that you’re using supports these values too before trying them:
liga
: standard ligaturesdlig
: discretionary ligaturesonum
: old style figureslnum
: lining figurestnum
: tabular figureszero
: slashed zerofrac
: fractionssups
: superscriptsubs
: subscriptsmcp
: small capsc2sc
: small capitals from capitalscase
: case-sensitive formshlig
: historical ligaturescalt
: contextual alternatesswsh
: swasheshist
: historical formsss**
: stylistic setskern
: kerninglocl
: localized formsrlig
: required ligaturesmedi
: medial formsinit
: initial formsisol
: isolated formsfina
: final formsmark
: markmkmk
mark-to-mark positioning
Combining multiple settings
To add multiple features you need to follow one value by another in a comma separated list, like so:
.element {
font-feature-settings:"smcp" 1, "onum" 1;
}
Prefixes
To get the best support across the browser spectrum, make sure to use these prefixes:
.element {
-webkit-font-feature-settings: "smcp" 1;
-moz-font-feature-settings: "smcp" 1;
-ms-font-feature-settings: "smcp" 1;
font-feature-settings: "smcp" 1;
}
Browser support
This browser support data is from Caniuse, which has more detail. A number indicates that browser supports the feature at that version and up.
Desktop
Chrome | Firefox | IE | Edge | Safari |
---|---|---|---|---|
21* | 15* | 10 | 12 | 9.1 |
Mobile / Tablet
Android Chrome | Android Firefox | Android | iOS Safari |
---|---|---|---|
123 | 124 | 4.4* | 9.3 |