The scroll-snap-type property enables scroll snapping on a container. It defines the axis and how strictly the browser snaps to child snap targets.
01
type
Enable snap.
02
x / y
Axis choice.
03
mandatory
Strict snap.
04
proximity
Soft snap.
05
container
Scroll box.
06
align
On children.
Fundamentals
Introduction
The scroll-snap-type property in CSS is a powerful feature that lets developers create smooth, scroll-snapping behavior for containers with overflow content.
It is especially useful for carousels, galleries, and any interface where you want precise control over scroll positions along the horizontal, vertical, or both axes.
Definition and Usage
Apply scroll-snap-type to the scroll container — the element with overflow: scroll or overflow: auto that wraps the snap targets.
Then set scroll-snap-align on child elements so the browser knows where each item should land when scrolling stops.
💡
Beginner Tip
Start with scroll-snap-type: x mandatory; on the container and scroll-snap-align: start; on each slide. That creates a simple horizontal carousel with predictable snap stops.
Foundation
📝 Syntax
The syntax for the scroll-snap-type property combines an axis with a snap strictness value. It is applied to scroll containers.
Both axes snap, which is helpful for two-dimensional gallery or tile layouts.
How It Works
both mandatory is less common than x or y alone, but it can power grid-like snap experiences when each tile is a snap target.
Companion
scroll-snap-type in the family
scroll-snap-type is the container property that turns snapping on. Pair it with scroll-snap-align on child snap targets and optional scroll-snap-stop when certain items must never be skipped.
The scroll container uses scroll-snap-type to turn on snapping along an axis.
Container
2
Targets set alignment
Child elements use scroll-snap-align so the browser knows where each snap target should land.
Target
3
Scroll motion finishes
When scrolling stops, mandatory mode forces a snap point; proximity mode snaps only if the scroll position is close enough.
Snap
=
★
Smooth snap scrolling
Carousels and panel scrollers feel polished because each stop lands on a defined snap target.
Compatibility
Browser Compatibility
The scroll-snap-type property is supported in most modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. However, it is always a good practice to test your website across different browsers to ensure compatibility.
✓ Scroll snap · Modern support
Reliable snap-type support
Current Chrome, Firefox, Safari, Edge, and Opera support scroll-snap-type on scroll containers.
97%Modern browser support
Google Chrome69+ · Desktop & Mobile
Full support
Mozilla Firefox68+ · Desktop & Mobile
Full support
Apple Safari14.1+ · macOS & iOS
Full support
Microsoft Edge79+ · Chromium
Full support
Opera56+ · Modern versions
Full support
Testing tip
Test horizontal and vertical snap containers on mobile browsers to confirm mandatory and proximity modes feel natural.
scroll-snap-type property97% supported
Bottom line:scroll-snap-type is safe to use in modern projects for scroll containers that need snap behavior.
Wrap Up
Conclusion
The scroll-snap-type property is a valuable tool for creating intuitive and user-friendly scrolling experiences. By enabling snapping on scroll containers, you can enhance the navigational flow of carousels and panel scrollers.
Experiment with x mandatory, y mandatory, and proximity to see how each configuration changes the feel of your layout.
Apply scroll-snap-type on the scroll container, not snap targets
Start with x mandatory for horizontal carousels
Use y mandatory for full-height vertical panel flows
Add scroll-snap-align on each child snap target
Test mandatory vs proximity on touch devices
❌ Don’t
Expect snapping without scroll-snap-align on child targets
Set scroll-snap properties on every nested element unnecessarily
Use mandatory everywhere if proximity feels better for your layout
Forget overflow scrolling on the container itself
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about scroll-snap-type
Use these points when enabling snap behavior on scroll containers.
5
Core concepts
★01
none Default
No snapping.
Default
⚙02
x / y / both
Axis choice.
Axis
◉03
mandatory
Strict snap.
Mode
▦04
proximity
Soft snap.
Mode
▦05
container
Set here first.
Scope
🔄06
scroll-snap-align
On children.
Companion
❓ Frequently Asked Questions
scroll-snap-type enables scroll snapping on a scroll container. It defines the axis (x, y, or both) and how strictly the browser must snap to snap points using mandatory or proximity.
mandatory forces the scroll container to snap to a snap point when scrolling ends. proximity snaps only when the scroll position is close enough to a snap point, allowing a freer scroll feel.
The default value is none, which means no scroll snapping occurs on the container.
Apply it to the scroll container itself — the element with overflow scroll or auto that holds the snap targets, such as a carousel wrapper or vertical panel scroller.
Use it for carousels, image galleries, onboarding screens, and any layout where each slide or panel should land at a predictable position when scrolling stops.