scroll-margin-block-end

Sets the margin between the end of an element and the edge of its scroll container specifically for 'scroll snapping'. This ensures that when an element snaps into view, it doesn't bump directly against the edge.

It is documented as part of the CSS Scroll Snap specification.

/* Usage Example */
.card {
  /* Keeps a 30px 'buffer' at the end of the element when it snaps into view */
  scroll-margin-block-end: 30px;
  scroll-snap-align: end;
}

/* Global values */
scroll-margin-block-end: inherit;
scroll-margin-block-end: initial;
scroll-margin-block-end: revert;
scroll-margin-block-end: revert-layer;
scroll-margin-block-end: unset;
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.

69+
68+
15+
79+
Kinsta

Your first month is free

Managed WordPress hosting for faster sites.

Learn more

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC