CSS scroll-padding-top Property
Description
The scroll-padding-top property adjusts the internal top offset that the browser uses when bringing a point in a scroll container into view. It creates an invisible inset at the top edge of the scrollport that the browser treats as reserved space for alignment and snapping calculations — the point scrolled to will land just below that inset instead of flush with the container’s top edge. Importantly, this does not change the box model or the actual layout or size of any element; it only affects how scrolling and snap alignment are computed.
This property is commonly used together with container-level scroll padding controls such as scroll-padding, which sets all sides’ insets in a single declaration. It also influences how scroll snap behavior positions snap targets when a container uses snapping, so it interacts functionally with properties that control snapping behavior like scroll-snap-type. In those scenarios the inset created by scroll-padding-top alters the effective snap area so that snapped elements appear offset from the top as intended (for example, to accommodate a fixed header).
Contrast this with element-level offsets like scroll-margin-top, which are applied by the elements being scrolled to rather than by the scroll container. Use the container-side inset when you want a universal top offset for all scroll targets inside a particular scrollport (for instance, to keep content visible beneath a persistent toolbar), and use element-level margins when you need per-element control. Because scroll-padding-top only affects alignment, it is particularly useful for fragment links, programmatic focus/scroll-into-view actions, and keyboard navigation where preserving visible context (e.g., preventing content from being hidden under overlays or fixed headers) matters.
In practical use, set the property on the scrolling container (the element that has the scrolling context) and test with the kinds of scrolling interactions you care about — keyboard focus, fragment navigation, and snap scrolling — to ensure the offset behaves as expected. Because it doesn’t alter layout, it is a safe tool to reserve visual space for UI chrome without introducing additional spacing inside content flows.
Definition
- Initial value
- auto
- Applies to
- scroll containers
- Inherited
- no
- Computed value
- as specified
- Animatable
- by computed value type
- JavaScript syntax
- object.style.scrollPaddingTop
Interactive Demo
Syntax
scroll-padding-top: 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-top 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
