scroll-snap-type
Enables scroll snapping on a container, forcing the scroll position to 'snap' to certain elements. It converts a smooth scroll into a stepped, slider-like experience.
It is documented as part of the CSS Scroll Snap specification.
Syntax
/* Usage Example */
.carousel-container {
display: flex;
overflow-x: auto;
scroll-snap-type: x mandatory;
/* ensures the scroll always stops exactly on a child element */
}
/* Syntax */
scroll-snap-type: none;
scroll-snap-type: block;
scroll-snap-type: inline;
scroll-snap-type: both;
scroll-snap-type: mandatory;
scroll-snap-type: proximity;
/* Global values */
scroll-snap-type: inherit;
scroll-snap-type: initial;
scroll-snap-type: revert;
scroll-snap-type: revert-layer;
scroll-snap-type: unset;
scroll-snap-type 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.
69+
99+
11+
79+