scroll-snap-align

Used on children within a scroll-snap container to define which part of the element should snap to the container. You can snap to the start, center, or end of the element.

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

/* Usage Example */
.carousel-item {
  scroll-snap-align: center;
  /* centers each item in the viewport when scrolling stops */
}

/* Syntax */
scroll-snap-align: none;
scroll-snap-align: start;
scroll-snap-align: end;
scroll-snap-align: center;

/* Global values */
scroll-snap-align: inherit;
scroll-snap-align: initial;
scroll-snap-align: revert;
scroll-snap-align: revert-layer;
scroll-snap-align: 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+
11+
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