line-height-step
CSS property sets the step unit for line box heights. When the property is set, line box heights are rounded up to the closest multiple of the unit.
/* Point values */ line-height-step: 18pt;
line-height-step
property is specified as any one of the following:
<length>
.
| 初始值 |
0
|
|---|---|
| 适用于 | block containers |
| 继承 | yes |
| 计算值 |
absolute
<length>
|
| 动画类型 | discrete |
<length>
In the following example, the height of line box in each paragraph is rounded up to the step unit. The line box in
<h1>
does not fit into one step unit and thus occupies two, but it is still centered within the two step unit.
:root {
font-size: 12pt;
--my-grid: 18pt;
line-height-step: var(--my-grid);
}
h1 {
font-size: 20pt;
margin-top: calc(2 * var(--my-grid));
}
The result of these rules is shown below in the following screenshot:
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Rhythmic Sizing
The definition of 'line-height-step' in that specification. |
工作草案 | 初始定义。 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
line-height-step
Experimental
|
Chrome
完整支持
60
Disabled
|
Edge
完整支持
79
Disabled
|
Firefox 不支持 No | IE 不支持 No |
Opera
完整支持
47
Disabled
|
Safari 不支持 No | WebView Android 不支持 No |
Chrome Android
完整支持
60
Disabled
|
Firefox Android 不支持 No |
Opera Android
完整支持
44
Disabled
|
Safari iOS 不支持 No | Samsung Internet Android 不支持 No |
完整支持
不支持
实验。期望将来行为有所改变。
用户必须明确启用此特征。
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