files/en-us/web/css/reference/at-rules/@font-feature-values/index.md
The @font-feature-values CSS at-rule lets you use a common name in the {{cssxref("font-variant-alternates")}} property for features activated differently in OpenType. This can help simplify your CSS when using multiple fonts.
The @font-feature-values at-rule may be used either at the top level of your CSS or inside any CSS conditional-group at-rule.
@font-feature-values Font Name {
font-display: swap;
@styleset {
nice-style: 12;
}
@swash {
fancy: 2;
}
}
Each @font-feature-values block can contain a list of feature value blocks (listed below), as well as the {{cssxref("@font-feature-values/font-display", "font-display")}} descriptor.
@swash
ident1: 2 is valid, but ident2: 2 4 isn't.@annotation
ident1: 2 is valid, but ident2: 2 4 isn't.@ornaments
ident1: 2 is valid, but ident2: 2 4 isn't.@stylistic
ident1: 2 is valid, but ident2: 2 4 isn't.@styleset
ident1: 2 4 12 1 maps to the OpenType values ss02, ss04, ss12, and ss01. Note that values higher than 99 are valid, but don't map to any OpenType values and are ignored.@character-variant
ident1: 3 maps to cv03=1, and ident2: 2 4 maps to cv02=4, but ident2: 2 4 5 is invalid.{{csssyntax}}
/* At-rule for "nice-style" in Font One */
@font-feature-values Font One {
@styleset {
nice-style: 12;
}
}
/* At-rule for "nice-style" in Font Two */
@font-feature-values Font Two {
@styleset {
nice-style: 4;
}
}
/* Apply the at-rules with a single declaration */
.nice-look {
font-variant-alternates: styleset(nice-style);
}
{{Specifications}}
{{Compat}}