scroll-margin-inline-end

Sets the snap margin at the 'end' of an element in the text flow (usually the right side in English). It ensures a gap between the element and the edge of the scroll container when it snaps.

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

/* Usage Example */
.snap-card {
  /* Adds a 20px gap to the right when snapping in a horizontal slider */
  scroll-margin-inline-end: 20px;
  scroll-snap-align: end;
}

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