CSS font-variant-caps 属性值说明
值 | 描述 |
---|---|
normal | 不激活替代字形的使用。 |
small-caps | 允许显示小型资金。小型帽子字形使用大写字母的形式,但是减少到小写字母的大小。 |
all-small-caps | 允许显示大写字母和小写字母。 |
petite-caps | 允许显示娇小的首都。 |
all-petite-caps | 允许为大写和小写字母显示娇小的首都。 |
unicase | 允许以正常的小写字母显示大写字母的小写字母的混合。 |
titling-caps | 允许展示标题首字母。 |
initial | 它使属性使用其默认值。 |
inherit | 它从其父母元素继承了属性。 |
语法
font-variant-caps: normal | small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps;
font-variant-caps 属性示例:
<!DOCTYPE html> <html> <head> <title>The title of the document </title> <style> .all-small-caps { font-variant-caps: all-small-caps; font-style: italic; } .small-caps { font-variant-caps: small-caps; font-style: italic; } .normal { font-variant-caps: normal; font-style: italic; } </style> </head> <body> <h2>Font-variant-caps 属性示例</h2> <p class="all-small-caps"> The font-variant-caps CSS property controls the use of alternate glyphs for capital letters. </p> <p class="small-caps">Small caps!</p> <p class="normal">Normal caps!</p> </body> </html>
在 CSS1 和 CSS2 中,指定小型大写字母的是 font-variant 属性。
但在 CSS3 中,此属性已成为 CSS3 属性(如 font-variant-caps 属性)的简写。
此属性允许为小的、小巧的大写字母和标题选择替代字形,包括许多有用的值,例如:
- normal
- small-caps
- all-small-caps
- petite-caps
- all-petite-caps
- unicase
- titling-caps
当给定的字体涉及不同大小的大写字母字形时, font-variant-caps 属性会选择最合适的字形。
如果小大写字形不可用,它们将使用大写字形呈现。
font-variant-caps 属性考虑了特定于语言的大小写映射规则(例如,在德语 (de) 中,ß 可能会变为 ẞ (U+1E9E) 大写)。
初始值 | normal |
---|---|
应用于 | 所有元素。它还适用于::first-letter 和 ::first-line 伪元素。 |
继承 | 可继承 |
可动画的 | 无效 |
版本 | CSS3. |
DOM 语法 | Object.Style.fontvariantcaps =“Petite-Caps”; |
日期:2020-06-02 22:14:26 来源:oir作者:oir