swash() CSS Function
The swash() function turns on swash glyphs, decorative flourished letters, of a font with font-variant-alternates.
Description
The swash() CSS function is one of the functions used with the font-variant-alternates property to switch on alternative glyphs in an OpenType font. It enables swash glyphs: decorative letter forms with exaggerated flourishes, common in script and italic display fonts, often used for the first letter of a heading or invitation. It maps to the OpenType swsh and cswh features.
The argument is not a number but a name that you define yourself in a @font-feature-values rule for the font family, inside a @swash block. That rule maps the friendly name to the numeric index the font uses, so the same name can mean different glyph sets in different fonts. If the font has no matching feature, or no name is defined, the text is shown with its normal glyphs.
Only one name can be given. Swashes are usually applied to a few characters, such as a heading or the first letter, rather than to body text.
@font-feature-values "Playfair Display" {
@swash {
flourish: 1;
}
}
.invite h1 {
font-family: "Playfair Display", serif;
font-style: italic;
font-variant-alternates: swash(flourish);
}
Syntax
swash() = swash( <feature-value-name> )
Values
- <feature-value-name>A <custom-ident> defined in the @swash block of an @font-feature-values rule for the font family. It maps to the font's OpenType swsh (swash) feature.
Example
Browser Support
The following information will show you the current browser support for the CSS swash() function. Hover over a browser icon to see the version that first introduced support for this CSS function.
Desktop





Tablets & Mobile





