MDN self-hosted library · e01.org

Scroll snap

Scroll snapping is a feature where content "snaps" to a specific position when a scroll operation finishes, such as a paragraph, a sentence, or an image boundary, rather than stopping at some arbitrary point.

no runnable cells glossary-definition upstream source

Scroll snapping is a feature where content "snaps" to a specific position when a scroll operation finishes, such as a paragraph, a sentence, or an image boundary, rather than stopping at some arbitrary point.

For example, a carousel without scroll snapping could finish scrolling in the middle of an image, leaving it partially visible. Scroll snapping provides a better experience by allowing developers to ensure that a complete visible image will snap into place.

Scroll snapping can be implemented using CSS scroll-snapping features or JavaScript.

See also

  • scroll-snap-type
  • scroll-snap-align
  • scroll-padding
  • scroll-margin
  • CSS scroll snap module