at 规则 @font-face 的 CSS 描述符 line-gap-override 决定了字体的行距度量。此指标是建议的行间距。
可能的值
CSS 描述符 line-gap-override 可以具有以下值之一:
- normal:指标值取自字体文件。这是默认值。
- <percentage>:任何百分比值。
语法
line-gap-override: normal | 80%;
CSS line-gap-override - 覆盖本地字体的指标
以下示例演示了如何使用 @font-face 规则的行间距覆盖描述符。
<html>
<head>
<style>
@font-face {
font-family: "Line gap override";
src: local(Arial Bold);
line-gap-override: 170%;
}
h1.with-override {
font-family: "Line gap override";
}
h1 {
border: 2px solid red;
width: max-content;
}
</style>
</head>
<body>
<h1>No Override</h1>
<h1 class="with-override">Line Gap Override Applied</h1>
</body>
</html>
在上面的例子中:
- 规则 @font-face 声明为行间隙覆盖的值。
- 提供了一个字体系列标识符,该标识符用于 h1 元素上的类 .with-override。
- 根据 line-gap-override 的值,将显示 h1 元素中的文本。
- 尝试更改 line-gap-override 的值,并查看更改后的效果。