line-height-step

line-height-step

line-height-stepCSS属性定义行框高度的阶梯单位。当步长单位为正时,线框高度向上舍入到最接近的单位倍数。负值无效。

/* Keyword values */ line-height-step: none; /* Point values */ line-height-step: 18pt;

Initial valuenone
应用对象block container elements
是否可继承yes
媒体visual
计算值an absolute length; if the keyword none is specified, the computed value is 0
动画类型discrete
规范顺序per grammar

语法

line-height-step属性指定为下列任一项:

  • 阿<length>

  • 关键词none...

none没有价值。<length>指定<length>用于计算直线盒的高度步长。

形式语法

none | <length>

实例

在下面的示例中,每个段落中的行框的高度被舍入到步进单元。线盒<h1>不适合于一个步骤单元,因此占据两个步骤单元,但它仍然集中在两个步骤单元内。

:root {   font-size: 12pt;   --my-grid: 18pt;   line-height-step: var(--my-grid } h1 {   font-size: 20pt;   margin-top: calc(2 * var(--my-grid) }

这些规则的结果如下所示。

二次

规范

SpecificationStatusComment
CSS Rhythmic SizingThe definition of 'line-height-step' in that specification.Working DraftInitial definition.

浏览器兼容性

FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support59???47?

FeatureAndroid WebviewChrome for AndroidEdgeFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support5959???47?