font-synthesis-small-caps
font-synthesis-small-caps CSS 属性让你指定当字体家族中缺少小型大写字母(small-caps)字形时,浏览器是否可以合成该字形。小型大写字母通常采用大写字母的形式,但会缩小到小写字母的大小。
通常,使用简写属性 font-synthesis 来控制所有字体合成值会更方便。
语法
css
/* Keyword values */
font-synthesis-small-caps: auto;
font-synthesis-small-caps: none;
/* Global values */
font-synthesis-small-caps: inherit;
font-synthesis-small-caps: initial;
font-synthesis-small-caps: revert;
font-synthesis-small-caps: revert-layer;
font-synthesis-small-caps: unset;
值
正式定义
| 初始值 | auto |
|---|---|
| 应用于 | 所有元素和文本。它也适用于 ::first-letter 和 ::first-line。 |
| 继承性 | 是 |
| 计算值 | 同指定值 |
| 动画类型 | 离散 |
正式语法
font-synthesis-small-caps =
auto |
none
示例
禁用小型大写字母字形的合成
此示例展示了在 Montserrat 字体中关闭浏览器合成小型大写字母字形。
HTML
html
<p class="english">
These are the default <span class="small-caps">small-caps</span>,
<strong>bold</strong>, and <em>oblique</em> typefaces.
</p>
<p class="english no-syn">
The <span class="small-caps">small-caps</span> typeface is turned off here but
not the <strong>bold</strong> and <em>oblique</em> typefaces.
</p>
CSS
css
@import "https://fonts.googleapis.ac.cn/css2?family=Montserrat&display=swap";
.english {
font-family: "Montserrat", sans-serif;
}
.small-caps {
font-variant: small-caps;
}
.no-syn {
font-synthesis-small-caps: none;
}
结果
规范
| 规范 |
|---|
| CSS 字体模块第 4 级 # font-synthesis-small-caps |
浏览器兼容性
加载中…