CSS scroll-padding-block Property
Description
The scroll-padding-block property defines an inset on the block axis that the browser treats as part of the scroll container’s snapport and "visible" scroll area when aligning content into view. In practice this means the browser offsets automatic scrolling and scroll-snapping calculations so that elements are considered "in view" a little before they actually hit the container’s physical edge. Because it is a logical property, the axis it affects follows the writing mode and direction of the document — in a vertical writing mode it affects the vertical inset, while in horizontal or mixed writing modes it follows the logical block direction.
You commonly use scroll-padding-block to reserve space for overlays like sticky headers or footers so that programmatic scrolling (for example, calls that bring an element into view) and scroll-snap behavior do not position the target underneath those overlays. It operates at the container level and adjusts the scrollport rather than changing visual layout; for layout spacing you would use padding-block, while the related shorthand scroll-padding controls both the block and inline scroll insets together. Because it only affects the scrollable container’s reference region, it’s the right tool when you want the snapping or auto-scroll alignment to account for a persistent UI element without altering the element’s own box model.
This property interacts with scroll-snapping and programmatic scrolling: it changes the target offsets used by the snapping algorithm and by methods like element.scrollIntoView. To control how individual items participate in snapping you can use a matching concept on the child element such as scroll-margin-block, which influences where a particular element will land relative to the adjusted snapport. Also keep in mind that the overall snapping behavior is governed by the container’s snap settings—see scroll-snap-type—so scroll-padding-block is typically used in concert with those settings to achieve smooth, predictable alignment in complex UIs.
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.scrollPaddingBlock
Interactive Demo
Syntax
scroll-padding-block: auto | <length-percentage [0,∞]>
Values
- autoThe offset is determined by the user agent. This will generally be 0px, but a user agent is able 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-block 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
