font-variant-caps
CSS
property controls the use of alternate glyphs for capital letters.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
When a given font includes capital letter glyphs of multiple different sizes, this property selects the most appropriate ones. If petite capital glyphs are not available, they are rendered using small capital glyphs. If these are not present, the browser synthesizes them from the uppercase glyphs.
Fonts sometimes include special glyphs for various caseless characters (such as punctuation marks) to better match the capitalized characters around them. However, small capital glyphs are never synthesized for caseless characters.
This property accounts for language-specific case mapping rules. For example:
i
(one with the dot, one without) and two case pairings:
i
/
İ
and
ı
/
I
.
ß
may become
ẞ
(U+1E9E) in uppercase.
ά
/
Α
), except for the disjunctive eta (
ή
/
Ή
). Also, diphthongs with an accent on the first vowel lose the accent and gain a diacritic on the second vowel (
άι
/
ΑΪ
).
/* Keyword values */ font-variant-caps: normal; font-variant-caps: small-caps; font-variant-caps: all-small-caps; font-variant-caps: petite-caps; font-variant-caps: all-petite-caps; font-variant-caps: unicase; font-variant-caps: titling-caps; /* Global values */ font-variant-caps: inherit; font-variant-caps: initial; font-variant-caps: unset;
font-variant-caps
property is specified using a single keyword value from the list below. In each case, if the font doesn't support the OpenType value, then it synthesizes the glyphs.
normal
Deactivates of the use of alternate glyphs.
small-caps
smcp
). Small-caps glyphs typically use the form of uppercase letters but are reduced to the size of lowercase letters.
all-small-caps
c2sc
,
smcp
).
petite-caps
pcap
).
all-petite-caps
c2pc
,
pcap
).
unicase
unic
).
titling-caps
titl
). Uppercase letter glyphs are often designed for use with lowercase letters. When used in all uppercase titling sequences they can appear too strong. Titling capitals are designed specifically for this situation.
Large sections of text set with a
font-variant
value of
all-small-caps
or
all-petite-caps
may be difficult for people with cognitive concerns such as Dyslexia to read.
| 初始值 |
normal
|
|---|---|
| 适用于 |
所有元素。它还适用于
::first-letter
and
::first-line
.
|
| 继承 | yes |
| 计算值 | 如指定 |
| 动画类型 | discrete |
normal | small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps
<p class="small-caps">Firefox rocks, small caps!</p> <p class="normal">Firefox rocks, normal caps!</p>
.small-caps {
font-variant-caps: small-caps;
font-style: italic;
}
.normal {
font-variant-caps: normal;
font-style: italic;
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Fonts Module Level 3
The definition of 'font-variant-caps' in that specification. |
候选推荐 | 初始定义 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
font-variant-caps
|
Chrome 完整支持 52 | Edge 完整支持 79 |
Firefox
完整支持
34
|
IE 不支持 No | Opera 完整支持 39 | Safari 不支持 No | WebView Android 完整支持 52 | Chrome Android 完整支持 52 |
Firefox Android
完整支持
34
|
Opera Android 完整支持 41 | Safari iOS 不支持 No | Samsung Internet Android 完整支持 6.0 |
完整支持
不支持
用户必须明确启用此特征。
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