CSS scroll-snap-stop Property
The CSS scroll-snap-stop property controls whether a scrolling operation can pass over an element's snap position without stopping.
It accepts two values, normal and always. This property is useful in carousels, galleries, and other scroll-snapping interfaces where selected items should not be skipped during a single scrolling operation.
scroll-snap-stop Syntax
The scroll-snap-stop property accepts one keyword that determines whether a snap position may be passed over during scrolling.
Basic Syntax
selector {
scroll-snap-stop: always;
}
Available Values
.item {
scroll-snap-stop: normal;
}
.item {
scroll-snap-stop: always;
}
CSS-Wide Keywords
.item {
scroll-snap-stop: initial;
}
.item {
scroll-snap-stop: inherit;
}
.item {
scroll-snap-stop: unset;
}
.item {
scroll-snap-stop: revert;
}
.item {
scroll-snap-stop: revert-layer;
}
The property does not accept lengths, percentages, numerical values, or multiple keywords.
Property Values
| Value | Description |
|---|---|
normal |
Allows a scrolling operation to pass over snap positions when selecting its final destination. |
always |
Prevents a scrolling operation from passing over the element's snap position when that position is an applicable snap stop along the scrolling path. |
initial |
Resets the property to its initial value of normal. |
inherit |
Uses the computed value from the parent element. |
unset |
Resets the property to normal because it is not inherited. |
revert |
Reverts the property according to CSS cascade origin rules. |
revert-layer |
Reverts the property according to CSS cascade layer rules. |
Property Characteristics
| Characteristic | Value |
|---|---|
| Initial value | normal |
| Inherited | No |
| Applies to | All elements |
| Computed value | As specified |
| Animation type | Discrete |
| Percentages | Not applicable |
| Accepted values | normal, always |
| Number of values | One |
| Related properties | scroll-snap-type, scroll-snap-align |
Valid Values
.item {
scroll-snap-stop: normal;
}
.item {
scroll-snap-stop: always;
}
.item {
scroll-snap-stop: initial;
}
Invalid Values
.item {
scroll-snap-stop: mandatory;
}
.item {
scroll-snap-stop: proximity;
}
.item {
scroll-snap-stop: start;
}
.item {
scroll-snap-stop: 20px;
}
.item {
scroll-snap-stop: normal always;
}
The keywords mandatory and proximity belong to scroll-snap-type, while start belongs to scroll-snap-align.
How It Works
CSS Scroll Snap defines positions where a scrolling container can settle after scrolling. The scroll-snap-stop property influences whether the browser may pass over particular snap positions while selecting a destination.
The Scroll Container
.carousel {
display: flex;
overflow-x: auto;
scroll-snap-type: x mandatory;
}
The container enables mandatory scroll snapping along the horizontal axis.
The Snap Targets
.carousel .slide {
flex: 0 0 250px;
scroll-snap-align: start;
}
Each slide establishes a start-aligned snap position.
Controlling Snap Stops
.carousel .slide {
scroll-snap-stop: always;
}
Applicable snap positions marked always cannot be passed over by a single scrolling operation that would otherwise move beyond them.
How Snap Stops Are Selected
When scrolling has an intended direction and destination, the browser considers eligible snap positions along the scrolling path. An applicable always stop prevents the browser from selecting a destination beyond that position in the same operation.
Not Every Scroll Operation Behaves the Same
Scrolling with a wheel, touch gesture, keyboard, scrollbar, or JavaScript may produce different results because browsers distinguish between scrolling operations with different intended directions and destinations.
No Layout Changes
The property does not modify element dimensions, positioning, spacing, or overflow. It only affects scroll snap position selection.
The normal Value
The normal value is the default. It allows the browser to pass over snap positions while determining the final snapping destination.
Basic Example
.carousel .slide {
scroll-snap-align: start;
scroll-snap-stop: normal;
}
A sufficiently large scrolling gesture may move past several slides before the browser settles at a snap position.
Using normal With Mandatory Snapping
.carousel {
scroll-snap-type: x mandatory;
}
.carousel .slide {
scroll-snap-align: start;
scroll-snap-stop: normal;
}
Mandatory snapping requires an appropriate final snap position, but does not require stopping at every intermediate slide.
Using normal With Proximity Snapping
.carousel {
scroll-snap-type: x proximity;
}
.carousel .slide {
scroll-snap-align: center;
scroll-snap-stop: normal;
}
The browser may snap when a position is sufficiently close and may pass over other positions during larger scrolling gestures.
When to Use normal
Use normal when users should be free to move quickly through multiple items, such as browsing a long gallery or horizontally scrolling a collection of cards.
The always Value
The always value prevents a scrolling operation from passing over an applicable snap position while moving toward a destination beyond it.
Basic Example
.carousel .slide {
scroll-snap-align: start;
scroll-snap-stop: always;
}
When a scrolling operation would otherwise pass an eligible slide's snap position, the browser must stop at an applicable always position instead.
Marking Selected Slides
.carousel .slide {
scroll-snap-align: start;
scroll-snap-stop: normal;
}
.carousel .featured {
scroll-snap-stop: always;
}
Ordinary slides may be skipped, but a featured slide establishes a snap stop that cannot be passed over by an applicable scrolling operation.
Applying always to Every Slide
.carousel .slide {
scroll-snap-align: start;
scroll-snap-stop: always;
}
This is useful for interfaces where users should encounter each eligible snap position during successive directional scrolling operations.
Important Limitation
The always value does not force every scrolling operation to move exactly one item. It constrains passing over eligible snap positions, rather than defining a fixed scrolling distance.
Direct Navigation
Direct navigation to a particular target, including certain JavaScript scrolling operations, may move directly to that target without stopping at every intermediate always position.
When to Use always
Use always when particular items should be encountered during directional scrolling, such as important steps in a sequence or featured content in a carousel.
Using scroll-snap-type
The scroll-snap-type property belongs on the scroll container and determines the snapping axis and strictness.
Mandatory Snapping
.carousel {
overflow-x: auto;
scroll-snap-type: x mandatory;
}
.carousel .slide {
scroll-snap-align: start;
scroll-snap-stop: always;
}
The container uses mandatory horizontal snapping, while each slide prevents applicable scrolling operations from passing over its snap position.
Proximity Snapping
.carousel {
overflow-x: auto;
scroll-snap-type: x proximity;
}
.carousel .slide {
scroll-snap-align: start;
scroll-snap-stop: always;
}
Proximity snapping allows the browser more freedom in determining whether snapping occurs. The always value does not turn proximity snapping into mandatory snapping.
Vertical Snapping
.sections {
height: 400px;
overflow-y: auto;
scroll-snap-type: y mandatory;
}
.sections .section {
scroll-snap-align: start;
scroll-snap-stop: always;
}
Applicable vertical snap positions cannot be passed over during directional scrolling.
Disabling Snapping
.carousel {
scroll-snap-type: none;
}
.carousel .slide {
scroll-snap-stop: always;
}
With snapping disabled, scroll-snap-stop has no active snap positions to constrain.
Important Consideration
Use scroll-snap-type to control snapping behavior and scroll-snap-stop to control whether eligible snap positions may be passed over.
Using scroll-snap-align
The scroll-snap-align property defines where a target snaps, while scroll-snap-stop controls whether the browser can pass over that position.
| Property | Purpose |
|---|---|
scroll-snap-type |
Enables snapping and defines the snapping axis and strictness. |
scroll-snap-align |
Defines where a target aligns within the snapport. |
scroll-snap-stop |
Controls whether an applicable snap position may be passed over. |
Start-Aligned Stops
.slide {
scroll-snap-align: start;
scroll-snap-stop: always;
}
Center-Aligned Stops
.slide {
scroll-snap-align: center;
scroll-snap-stop: always;
}
End-Aligned Stops
.slide {
scroll-snap-align: end;
scroll-snap-stop: always;
}
No Snap Alignment
.slide {
scroll-snap-align: none;
scroll-snap-stop: always;
}
The element does not establish a snap position, so the always value has no snap position to protect.
Using Scroll Padding
.carousel {
scroll-padding-inline: 30px;
}
.carousel .slide {
scroll-snap-align: start;
scroll-snap-stop: always;
}
Scroll padding adjusts the alignment region without changing the meaning of always.
Scrolling Methods and Snap Stops
The effect of scroll-snap-stop depends partly on the type of scrolling operation.
Mouse Wheel Scrolling
Wheel scrolling may move through multiple snap positions. Applicable always stops prevent a single operation from passing over protected positions.
Touch and Trackpad Gestures
Momentum-based gestures can travel across several snap positions. The browser applies snap-stop constraints when selecting the final position for an applicable scrolling operation.
Keyboard Scrolling
Arrow keys, Page Up, Page Down, and other keyboard actions can produce different scrolling distances. Snap-stop behavior depends on how the browser interprets the operation.
Using scrollIntoView()
document.querySelector(".target").scrollIntoView({
behavior: "smooth",
block: "nearest",
inline: "center"
});
This method requests alignment with a specific target. Such direct navigation is not necessarily constrained to stop at every intermediate always position.
Using scrollBy()
document.querySelector(".carousel").scrollBy({
left: 300,
behavior: "smooth"
});
Relative scrolling requests may be subject to applicable snap-stop constraints. The resulting position depends on the container's snap settings and the browser's scrolling algorithm.
Respecting Reduced Motion
const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
document.querySelector(".target").scrollIntoView({
behavior: reduceMotion ? "instant" : "smooth",
block: "nearest",
inline: "center"
});
Use reduced-motion preferences when adding animated scrolling. The scroll-snap-stop property itself does not specify animation.
Important Consideration
Do not rely on scroll-snap-stop: always as a substitute for explicit navigation logic when an interface requires precise one-item-at-a-time movement.
Practical Examples
Step-by-Step Carousel
.steps {
display: flex;
overflow-x: auto;
scroll-snap-type: x mandatory;
}
.steps .step {
flex: 0 0 100%;
scroll-snap-align: start;
scroll-snap-stop: always;
}
Each step defines a protected snap position during applicable directional scrolling.
Featured Gallery Item
.gallery {
display: flex;
overflow-x: auto;
scroll-snap-type: x mandatory;
}
.gallery .image {
scroll-snap-align: center;
scroll-snap-stop: normal;
}
.gallery .featured {
scroll-snap-stop: always;
}
The featured item establishes a protected snap position while ordinary gallery items may be passed over.
Vertical Section Navigation
.section-container {
height: 100vh;
overflow-y: auto;
scroll-snap-type: y mandatory;
}
.section-container section {
min-height: 100vh;
scroll-snap-align: start;
scroll-snap-stop: always;
}
Sections establish protected vertical snap positions. Ensure content remains reachable when a section is taller than the viewport.
Mixed Snap-Stop Behavior
.carousel .item {
scroll-snap-align: start;
scroll-snap-stop: normal;
}
.carousel .item.important {
scroll-snap-stop: always;
}
Only items marked important establish protected snap stops.
Responsive Snap Stops
.carousel .slide {
scroll-snap-align: start;
scroll-snap-stop: always;
}
@media (min-width: 992px) {
.carousel .slide {
scroll-snap-stop: normal;
}
}
This example protects snap positions on smaller screens while allowing larger scrolling movements on wider screens.
scroll-snap-stop Example
This interactive example compares the default normal behavior with always. Each panel contains the same six snap targets. Use the buttons to request a large relative scroll, then compare how the browser handles intermediate snap positions.
HTML Example
<div class="snap-stop-demo">
<div class="snap-example normal">
<h3>Normal Snap Stops</h3>
<div class="snap-panel">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">4</div>
<div class="item">5</div>
<div class="item">6</div>
</div>
<button type="button" class="advance">Scroll Forward</button>
<button type="button" class="reset">Reset</button>
</div>
<div class="snap-example always">
<h3>Always Snap Stops</h3>
<div class="snap-panel">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">4</div>
<div class="item">5</div>
<div class="item">6</div>
</div>
<button type="button" class="advance">Scroll Forward</button>
<button type="button" class="reset">Reset</button>
</div>
</div>
CSS Example
.snap-stop-demo {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
gap: 20px;
}
.snap-stop-demo .snap-panel {
display: flex;
gap: 10px;
overflow-x: auto;
padding: 10px;
border: 1px solid #cbd5e1;
background-color: #f8fafc;
scroll-snap-type: x mandatory;
}
.snap-stop-demo .item {
flex: 0 0 100px;
padding: 25px 10px;
text-align: center;
background-color: #e2e8f0;
scroll-snap-align: start;
}
.snap-stop-demo .normal .item {
scroll-snap-stop: normal;
}
.snap-stop-demo .always .item {
scroll-snap-stop: always;
}
.snap-stop-demo button {
margin-top: 10px;
padding: 8px 12px;
cursor: pointer;
}
JavaScript Example
document.querySelectorAll(".snap-stop-demo .snap-example").forEach((example) => {
const panel = example.querySelector(".snap-panel");
const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)");
example.querySelector(".advance").addEventListener("click", () => {
panel.scrollBy({
left: 350,
behavior: reduceMotion.matches ? "instant" : "smooth"
});
});
example.querySelector(".reset").addEventListener("click", () => {
panel.scrollTo({
left: 0,
behavior: "instant"
});
});
});
Normal Snap Stops
Always Snap Stops
Click Scroll Forward in both panels. The normal panel may pass over several items, while the always panel must respect applicable intermediate snap stops. Click Reset to return to the beginning.
Changing always to normal
.snap-stop-demo .always .item {
scroll-snap-stop: normal;
}
Both panels now use the same snap-stop behavior.
Protecting Only One Item
.snap-stop-demo .always .item {
scroll-snap-stop: normal;
}
.snap-stop-demo .always .item:nth-child(3) {
scroll-snap-stop: always;
}
Only the third item establishes a protected snap position.
Browser Compatibility Note
The visible difference depends on the browser's treatment of relative scrolling requests, snap selection, and available scroll range. Manual wheel or trackpad gestures can provide an additional way to observe the behavior.
Accessibility Considerations
Snap stops can improve predictability, but overly restrictive scrolling can make an interface difficult to navigate.
Avoid Restricting Navigation Unnecessarily
Use always only where preventing skipped snap positions serves a meaningful purpose. Users should still be able to navigate efficiently through longer content.
Provide Keyboard Controls
Ensure carousel controls and interactive content are accessible through the keyboard. Provide visible focus indicators.
Do Not Trap Users
Mandatory snapping and protected stops must not prevent users from reaching content, especially when sections are larger than the snapport.
Respect Reduced Motion Preferences
The property does not define scrolling animation. When JavaScript or CSS adds smooth scrolling, provide a reduced-motion alternative.
Maintain Logical Reading Order
Scroll snapping should not replace meaningful document structure or change the expected keyboard focus order.
Test Multiple Input Methods
Verify behavior with mouse wheels, touchscreens, trackpads, keyboard navigation, and assistive technologies.
Provide Direct Navigation When Appropriate
For long sequences, allow users to select specific items rather than requiring repeated scrolling through every protected stop.
Common Mistakes
Using always Without Snap Alignment
.item {
scroll-snap-stop: always;
}
Without a snap position established by scroll-snap-align, the property has no applicable stop to protect.
Forgetting scroll-snap-type
The scroll container must have an appropriate scroll-snap-type value for snapping to be active.
Applying the Property Only to the Container
.carousel {
scroll-snap-stop: always;
}
This does not establish protected snap stops for the carousel's children. Apply the property to the intended snap targets.
Using mandatory as a Value
.item {
scroll-snap-stop: mandatory;
}
The mandatory keyword belongs to scroll-snap-type.
Using Multiple Values
.item {
scroll-snap-stop: normal always;
}
The property accepts only one keyword.
Expecting One Item Per Button Click
The always value constrains applicable scrolling operations but does not implement one-item navigation. Use explicit navigation logic when exact movement is required.
Expecting always to Override Proximity Snapping
The property does not change scroll-snap-type: proximity into mandatory snapping.
Assuming Direct Navigation Must Visit Every Stop
Direct scrolling to a target may bypass intermediate snap stops.
Ignoring Browser Differences
Scroll operations and snap target selection can vary between browsers and input methods.
Creating Excessively Restrictive Scrolling
Applying always to every target in a long sequence may make navigation unnecessarily slow or frustrating.
Important Considerations
Keep the following points in mind when using scroll-snap-stop:
- It controls whether applicable snap positions may be passed over during scrolling.
- Its initial value is
normal, and it is not inherited. - It accepts only
normalandalways. - The
normalvalue allows snap positions to be passed over. - The
alwaysvalue protects applicable snap positions from being passed over. - It does not define where a target aligns.
- Use
scroll-snap-alignto establish snap positions. - Use
scroll-snap-typeon the container to enable and configure snapping. - It does not create a scroll container or change overflow behavior.
- It does not affect normal layout spacing or element dimensions.
- It does not control scrolling animation or speed.
- It does not guarantee one-item-at-a-time navigation.
- Direct navigation to a specific target may bypass intermediate stops.
- Proximity snapping remains proximity-based when
alwaysis used. - Snap selection depends on the scrolling operation and browser behavior.
- Protected stops should not interfere with reading or keyboard navigation.
- Test behavior across different input methods and viewport sizes.
Browser Support
The CSS scroll-snap-stop property is widely supported in current versions of major browsers, including Chrome, Edge, Firefox, and Safari.
Older browser versions may not support the always value. Scroll snap behavior can also vary depending on the scrolling method and browser implementation.
For current compatibility information, visit Can I Use? and search for scroll-snap-stop.
When unsupported, scrolling and other supported scroll snap properties can continue to function, but the browser may pass over positions that would otherwise be protected by always.
Specifications
The scroll-snap-stop property is defined in CSS Scroll Snap Module Level 1.
CSS Scroll Snap Module Level 1
The specification defines how snap-stop values influence the selection of snap positions during scrolling operations.
For additional documentation and examples, consult MDN Web Docs.
