CSS scroll-margin-block property
Browser support · legacy reference
ChromeFully supports
SafariFully supports
FirefoxNot supported
Internet ExplorerNot supported
EdgeNot supported
OperaNot supported
Description
CSS scroll-margin-block property specifies the margin at the start and end sides of the scroll item. Please move the scrollbar to see the effect of margin.
The selection of start and end sides depends upon the writing-mode.
The start and end sides are top and bottom sides respectively for horizontal-tb writing-mode.
The start and end sides are left and right sides respectively for vertical-* writing-mode.
Syntax
scroll-margin-block :+ve length
Property values
+ve length Default
-
There is no margin at the start and end edges of the scroll snap area.
- Try it
scroll-margin-block: 0px; +ve length
-
It specifies the start and end edges offset of the scroll item.
In the demo, there is 100px margin at the start and end edges of the scroll snap area.
- Try it
scroll-margin-block: 100px;
Applicable to
It applies to scroll containers.