font-variant-alternates 属性控制替代字形的选择。
替代字形函数的名称(样式集、文体、字符变体、装饰、花体、注释)可以在@font-feature-values 中定义。
样式表中允许使用@font-feature-values 中指定的可读名称。
| 初始值 | normal |
|---|---|
| 应用于 | 所有元素。它还适用于伪元素::first-letter 和 ::first-line。 |
| 继承 | 可继承 |
| 可动画的 | 无效 |
| 版本 | CSS3. |
| DOM 语法 | Object.Style.FontVariantAlternates =“normal”; |
语法
font-variant-alternates: normal | historical-forms | stylistic() | styleset() | character-variant() | swash() | ornaments() | annotation();
font-variant-alternates 属性示例:
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
<style>
@font-feature-values "Leitura Display Swashes" {
@swash {
fancy: 1;
}
}
p {
font-size: 2rem;
}
.variant {
font-family: Leitura Display Swashes;
font-variant-alternates: swash(fancy);
}
</style>
</head>
<body>
<h2>Font-variant-alternates 属性示例</h2>
<p>只有 Firefox 支持这个属性。</p>
<p class="variant">只有 Firefox 支持这个属性。</p>
</body>
</html>
CSS font-variant-alternates 属性值说明
| 值 | 描述 |
|---|---|
| normal | 均未启用任何功能。 |
| historical forms | 启用历史形式的显示。 |
| stylistic() | 启用风格替代品的显示。 |
| styleset() | 启用具有风格集的显示。 |
| character-variant() | 使特定的风格替代品用于字符。 |
| swash() | 启用旋转字形。 |
| ornaments() | 启用饰品的显示。 |
| annotation() | 启用备用注释表格。 |
| initial | 它使属性使用其默认值。 |
| inherit | 它从其父母元素继承了属性。 |
日期:2020-06-02 22:14:32 来源:oir作者:oir
