scroll-margin-inline-start

Sets the snap margin at the 'start' of an element in the text flow (usually the left side in English). This is great for horizontal carousels to keep the current item from hugging the left edge.

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

/* Usage Example */
.carousel-item {
  /* Keeps the item 40px away from the left edge when it snaps into view */
  scroll-margin-inline-start: 40px;
  scroll-snap-align: start;
}

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

New CSS drops.

Join 750+ readers who've survived clearfix hacks.

ESC