CSS scroll-margin-block Property

❮ Previous Reference Next ❯


.scroller > div:nth-child(2) {
  scroll-margin-block: 1rem;

.scroller > div:nth-child(3) {
  scroll-margin-block: 2rem;



The scroll-margin-block CSS property sets the scroll margins of an element in the block dimension.

The scroll-margin-block property is a shorthand for the following CSS properties:

The scroll-margin values represent outsets defining the scroll snap area that is used for snapping this box to the snapport.

The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets.

Default value:0
JavaScript syntax:

Standard Syntax

scroll-margin-block: length|initial|inherit|revert|revert-layer|unset;

Browser Support


Property Values

The following table describes the values of this property:

Value Description
length An outset from the corresponding edge of the scroll container.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element animation-delay property.
revert Reverts the cascaded value of the property from its current value to the value the property
revert-layer Rollback styles to the ones specified in previous cascade layers.
unset Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not.

Default CSS Property Values

selectors {
  scroll-margin-block: 0;
❮ Previous Reference Next ❯