scroll-margin-block
A shorthand that sets both the start and end scroll margins at the same time. It creates a 'snap buffer' in the vertical direction (or whatever the 'block' axis is).
Quick example
h2 {
/* Adds a 2rem buffer on both the top and bottom when snapping to this header */
scroll-margin-block: 2rem;
} Quick facts
Initial value
See individual propertiesInherited
No
Applies to
all elements
Animation type
byComputedValueType
scroll-margin-block Browser Support
Widely available Since 2020 95% global usage
This feature is well established and works across many devices and browser versions. It has been available across browsers since 2020.
Safe to use without fallbacks.
69+
68+
15+
79+