CSS scroll-padding Property
Description
The scroll-padding property controls the inset of a scroll container’s “snap area” or effective scrollport — essentially shifting the area that the browser considers when aligning scrolled content into view. Rather than changing the box model or the layout of children, it modifies the region used by scrolling algorithms so that when an element is snapped or programmatically brought into view it appears offset from the container edges by the specified inset. This makes it possible to reserve visual space (for example, for a fixed header) without altering the element’s own padding or margin.
When used with scroll snapping, scroll-padding directly affects how and where items land relative to the container. It works together with snapping properties like scroll-snap-align and the container-level scroll-snap-type to determine the final position of snapped elements. Conceptually it is the container-side counterpart to element-side offsets such as scroll-margin, and it can be applied in logical axes via longhand properties like scroll-padding-block. Unlike regular padding, which affects layout and hit-testing, scroll-padding only alters scrolling alignment and snap calculations.
In practice, scroll-padding is useful for improving the visual result of in-page navigation and for creating comfortable snap positions. For example, it prevents content from being hidden under sticky headers when you jump to an anchor or call element.scrollIntoView, since the browser will treat the inset as reserved space. It also cooperates with scroll behaviors such as scroll-behavior, but it does not change how overflow is computed or how elements are sized — it simply shifts the target area the scrolling algorithms use. Because of that separation, you can adjust the perceived scroll destination without affecting the layout or flow of content.
Definition
- Initial value
- See individual properties
- Applies to
- scroll containers
- Inherited
- no
- Computed value
- See individual properties
- Animatable
- by computed value type
- JavaScript syntax
- object.style.scrollPadding
Interactive Demo
Syntax
scroll-padding: auto | <length-percentage [0,∞]>
Values
- autoThe offset is determined by the user agent. This will generally be 0px, but the user agent is free to detect and do something else if a non-zero value is more appropriate.
- <length-percentage>An inwards offset from the corresponding edge of the scrollport, as a valid <length> or a <percentage>.
Example
Browser Support
The following information will show you the current browser support for the CSS scroll-padding property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
