@font-feature-values
CSS
at-rule
lets you use a common name in the
font-variant-alternates
property for features activated differently in OpenType. This can help simplify your CSS when using multiple fonts.
@font-feature-values
at-rule may be used either at the top level of your CSS or inside any
CSS conditional-group at-rule
.
@swash
swash()
functional notation of
font-variant-alternates
. A swash feature value definition allows only one value:
ident1: 2
is valid, but
ident2: 2 4
isn't.
@annotation
annotation()
functional notation of
font-variant-alternates
. An annotation feature value definition allows only one value:
ident1: 2
is valid, but
ident2: 2 4
isn't.
@ornaments
ornaments()
functional notation of
font-variant-alternates
. An ornaments feature value definition allows only one value:
ident1: 2
is valid, but
ident2: 2 4
isn't.
@stylistic
stylistic()
functional notation of
font-variant-alternates
. A stylistic feature value definition allows only one value:
ident1: 2
is valid, but
ident2: 2 4
isn't.
@styleset
styleset()
functional notation of
font-variant-alternates
. A stylset feature value definition allows an unlimited number of values:
ident1: 2 4 12 1
maps to the OpenType values
ss02
,
ss04
,
ss12
,和
ss01
. Note that values higher than
99
are valid, but don't map to any OpenType values and are ignored.
@character-variant
character-variant()
functional notation of
font-variant-alternates
. A character-variant feature value definition allows either one or two values:
ident1: 3
maps to
cv03=1
,和
ident2: 2 4
maps to
cv02=4
, but
ident2: 2 4 5
is invalid.
@font-feature-values <family-name># { <feature-value-block-list> }where
<family-name> = <string> | <custom-ident>+
<feature-value-block-list> = <feature-value-block>+where
<feature-value-block> = <feature-type> '{' <feature-value-declaration-list> '}'where
<feature-type> = @stylistic | @historical-forms | @styleset | @character-variant | @swash | @ornaments | @annotation
<feature-value-declaration-list> = <feature-value-declaration>where
<feature-value-declaration> = <custom-ident>: <integer>+;
/* 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);
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Fonts Module Level 4
The definition of '@font-feature-values' in that specification. |
工作草案 | 初始定义。 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
@font-feature-values
|
Chrome 不支持 No | Edge 不支持 No |
Firefox
完整支持
34
|
IE 不支持 No | Opera 不支持 No | Safari 完整支持 9.1 | WebView Android 不支持 No | Chrome Android 不支持 No |
Firefox Android
完整支持
34
|
Opera Android 不支持 No | Safari iOS 完整支持 9.3 | Samsung Internet Android 不支持 No |
@annotation
|
Chrome 不支持 No | Edge 不支持 No |
Firefox
完整支持
34
|
IE 不支持 No | Opera 不支持 No | Safari 完整支持 9.1 | WebView Android 不支持 No | Chrome Android 不支持 No |
Firefox Android
完整支持
34
|
Opera Android 不支持 No | Safari iOS 完整支持 9.3 | Samsung Internet Android 不支持 No |
@character-variant
|
Chrome 不支持 No | Edge 不支持 No |
Firefox
完整支持
34
|
IE 不支持 No | Opera 不支持 No | Safari 完整支持 9.1 | WebView Android 不支持 No | Chrome Android 不支持 No |
Firefox Android
完整支持
34
|
Opera Android 不支持 No | Safari iOS 完整支持 9.3 | Samsung Internet Android 不支持 No |
@historical-forms
|
Chrome 不支持 No | Edge 不支持 No |
Firefox
完整支持
34
|
IE 不支持 No | Opera 不支持 No | Safari 完整支持 9.1 | WebView Android 不支持 No | Chrome Android 不支持 No |
Firefox Android
完整支持
34
|
Opera Android 不支持 No | Safari iOS 完整支持 9.3 | Samsung Internet Android 不支持 No |
@ornaments
|
Chrome 不支持 No | Edge 不支持 No |
Firefox
完整支持
34
|
IE 不支持 No | Opera 不支持 No | Safari 完整支持 9.1 | WebView Android 不支持 No | Chrome Android 不支持 No |
Firefox Android
完整支持
34
|
Opera Android 不支持 No | Safari iOS 完整支持 9.3 | Samsung Internet Android 不支持 No |
@styleset
|
Chrome 不支持 No | Edge 不支持 No |
Firefox
完整支持
34
|
IE 不支持 No | Opera 不支持 No | Safari 完整支持 9.1 | WebView Android 不支持 No | Chrome Android 不支持 No |
Firefox Android
完整支持
34
|
Opera Android 不支持 No | Safari iOS 完整支持 9.3 | Samsung Internet Android 不支持 No |
@stylistic
|
Chrome 不支持 No | Edge 不支持 No |
Firefox
完整支持
34
|
IE 不支持 No | Opera 不支持 No | Safari 完整支持 9.1 | WebView Android 不支持 No | Chrome Android 不支持 No |
Firefox Android
完整支持
34
|
Opera Android 不支持 No | Safari iOS 完整支持 9.3 | Samsung Internet Android 不支持 No |
@swash
|
Chrome 不支持 No | Edge 不支持 No |
Firefox
完整支持
34
|
IE 不支持 No | Opera 不支持 No | Safari 完整支持 9.1 | WebView Android 不支持 No | Chrome Android 不支持 No |
Firefox Android
完整支持
34
|
Opera Android 不支持 No | Safari iOS 完整支持 9.3 | Samsung Internet Android 不支持 No |
完整支持
不支持
用户必须明确启用此特征。
font-variant-alternates
property that uses values that this at-rule defines.
@font-face
@font-feature-values
font
font-family
font-feature-settings
font-kerning
font-language-override
font-optical-sizing
font-size
font-size-adjust
font-smooth
font-stretch
font-style
font-synthesis
font-variant
font-variant-alternates
font-variant-caps
font-variant-east-asian
font-variant-ligatures
font-variant-numeric
font-variant-position
font-variation-settings
font-weight
line-height
line-height-step