CSS scroll-snap-stop Property
Example
Instead of scrolling past elements when swiping fast on a trackpad or a touch screen, force scrolling to stop and snap on the next element:
div {
scroll-snap-stop: always;
}
Try it Yourself »
Definition and Usage
When swiping fast on a trackpad or a touch screen, the scroll-snap-stop
property specifies whether to scroll past elements or to stop and snap on the next element.
To control scroll snap stop behaviour, the scroll-snap-stop
and scroll-snap-align
properties must be set on the child elements, and the scroll-snap-type
property must be set on the parent element.
Note: You must use swipe gesture on a device with a trackpad or a touch screen to experience the effect of the scroll-snap-stop
property.
Default value: | normal |
---|---|
Inherited: | no |
Animatable: | no. Read about animatable |
Version: | CSS3 |
JavaScript syntax: | object.style.scrollSnapStop="always" Try it |
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
scroll-snap-stop | 75.0 | 79.0 | 103.0 | 15.0 | 62.0 |
CSS Syntax
scroll-snap-stop: normal|always|initial|inherit;
Property Values
Value | Description |
---|---|
normal | Default value. After fast swipe with touchpad or touch screen, the scrolling slows down slowly and passes several elements. |
always | After fast swipe with touchpad or touch screen, scrolling stops and the next element snaps into focus. |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Related Pages
CSS scroll-snap-align property: CSS Scroll-snap-align property
CSS scroll-snap-type property: CSS Scroll-snap-type property