CSS scroll snap Last Updated : 01 Oct, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report The CSS Scroll Snap module is an inbuilt feature in CSS that allows developers to control the behavior of scrollable elements and their children with precision. It introduces a new method of scrolling where the viewport "snaps" to predefined points. This ensures that the content aligns perfectly in the view after scrolling operations, improving the user experience for touch devices, carousels, and other scrollable areas. Before the Scroll Snap module, there was a similar concept known as Scroll Snap Point, but it was deprecated and replaced by the more powerful Scroll Snap module introduced in HTML5.CSS Scroll Snap PropertiesThe Scroll Snap module is divided into two parts:Properties for Scroll Containers: These apply to the parent container that holds scrollable content.Properties for Children of Scroll Containers: These apply to the child elements within the scrollable container that you want to control the snapping behavior for.CSS Properties for Scroll ContainersPropertiesDescriptionscroll-snap-typeThis property defines how strict snap points are enforced on the scroll container.scroll-snap-stopThis property defines whether the scroll container is allowed to "pass over" possible snap positions.scroll-paddingThis property is a shorthand property that defines all of the scroll-padding-*scroll-padding-topThis property defines offsets for the top of the optimal viewing region of the scrollport.scroll-padding-rightThis property defines offsets for the right of the optimal viewing region of the scrollport.scroll-padding-bottomThis property defines offsets for the bottom of the optimal viewing region of the scrollport.scroll-padding-leftThis property defines offsets for the left of the optimal viewing region of the scrollport.scroll-padding-inlineThis property is a shorthand property which sets the scroll-padding longhand for the inline dimension.scroll-padding-inline-startThis property defines offsets for the start edge in the inline dimension of the optimal viewing region of the scrollport.scroll-padding-inline-endThis property defines offsets for the end edge in the inline dimension of the optimal viewing region of the scrollport.scroll-padding-blockThis property is a shorthand property which sets the scroll-padding longhand for the block dimension.scroll-padding-block-startThis property defines offsets for the start edge in the block dimension of the optimal viewing region of the scrollport.scroll-padding-block-endThis property defines offsets for the end edge in the block dimension of the optimal viewing region of the scrollport.CSS Properties for Children of Scroll ContainersPropertiesDescriptionscroll-snap-alignThis property defines the box’s snap position as an alignment of its snap area.scroll-marginThis property is a shorthand property that defines all of the scroll-margin.scroll-margin-topThis property defines the top margin of the scroll snap area that is used for snapping this box to the snapport.scroll-margin-rightThis property defines the right margin of the scroll snap area that is used for snapping this box to the snapport.scroll-margin-bottomThis property defines the bottom margin of the scroll snap area that is used for snapping this box to the snapport.scroll-margin-leftThis property defines the left margin of the scroll snap area that is used for snapping this box to the snapport.scroll-margin-inlineThis property is a shorthand property which sets the scroll-margin longhand for the inline dimension.scroll-margin-inline-startThis property defines margin of the scroll snap area at the start of the inline dimension.scroll-margin-inline-endThis property defines margin of the scroll snap area at the end of the inline dimension.scroll-margin-blockThis property is a shorthand property which sets the scroll-margin longhand for the block dimension.scroll-margin-block-startThis property defines the margin of the scroll snap area at the start of the block dimension.scroll-margin-block-endThis property defines the margin of the scroll snap area at the end of the block dimension.Supported Browsers:Google ChromeInternet ExplorerFirefoxSafariOpera Comment More infoAdvertise with us Next Article CSS scroll-snap-align property S skyridetim Follow Improve Article Tags : Web Technologies CSS CSS-Properties Similar Reads CSS | Scroll Snap type The Scroll Snap type property is an inbuilt property in the Scroll Snap module. Without the Scroll Snap module, the image gallery will look ridiculous. Before the Scroll Snap module, this effect can be achieved by JavaScript but during this days Scroll Snap with the CSS can be achieved. This propert 3 min read CSS | Scroll Snap stop The Scroll Snap stop property is an inbuilt property in the Scroll Snap module. The Scroll Snap stop property stops or you can lock the scroll at some specific position that you define. It works like there is a pattern in your every slide and when the user scrolls the slide the pattern automatically 2 min read CSS scroll-snap-align property CSS scroll-snap-align property represents the snap position of a box's snap area within the element's or container's snap port.Syntax:scroll-snap-align: Keyword_Values;/* Or */scroll-snap-align: Global_Values;Property values: The scroll-snap-align property accepts two values mentioned above and desc 1 min read CSS | Scroll Padding top The Scroll Padding top is an inbuilt property in Scroll Snap module. This property set the scroll padding top longhand. This property acts as a magnet on the top of the sliding element that stick to the top of the view-port and stop the scrolling(forcefully) in that place. The Scroll Padding propert 2 min read CSS | Scroll Padding top The Scroll Padding top is an inbuilt property in Scroll Snap module. This property set the scroll padding top longhand. This property acts as a magnet on the top of the sliding element that stick to the top of the view-port and stop the scrolling(forcefully) in that place. The Scroll Padding propert 2 min read CSS | ::-webkit-scrollbar ::-webkit-scrollbar is a pseudo-element in CSS employed to modify the look of a browser's scrollbar. Before we start with how it works and how can it be implemented, we need to know some facts about the element. Browsers like Chrome, Safari and Opera support this standard Browsers like firefox don't 3 min read Like