W3cubDocs

/CSS

line-height-step

The 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;

Syntax

The line-height-step property is specified as any one of the following:

Values

<length>
The specified <length> is used in the calculation of the line box height step.

Formal definition

Initial value 0
Applies to block containers
Inherited yes
Computed value absolute <length>
Animation type discrete

Formal syntax

<length>

Examples

Setting step unit for line box height

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:

How the line-height-step property affects the appearance of text.

Specifications

Specification Status Comment
CSS Rhythmic Sizing
The definition of 'line-height-step' in that specification.
Working Draft Initial definition.

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
line-height-step 60
Disabled
60
Disabled
Disabled From version 60: this feature is behind the --enable-blink-features=CSSSnapSize runtime flag.
79
Disabled
79
Disabled
Disabled From version 79: this feature is behind the --enable-blink-features=CSSSnapSize runtime flag.
No No 47
Disabled
47
Disabled
Disabled From version 47: this feature is behind the --enable-blink-features=CSSSnapSize runtime flag.
No
Mobile
Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
line-height-step No 60
Disabled
60
Disabled
Disabled From version 60: this feature is behind the --enable-blink-features=CSSSnapSize runtime flag.
No 44
Disabled
44
Disabled
Disabled From version 44: this feature is behind the --enable-blink-features=CSSSnapSize runtime flag.
No No

See also

© 2005–2020 Mozilla and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/line-height-step