scroll-padding

Sets the padding (inner offset) of a scroll container. It ensures that when elements snap or are scrolled into view, they stay a certain distance away from the edges of the container.

Quick example

html {
  scroll-padding-top: 4rem;
  scroll-behavior: smooth;
  /* ensures all anchor-link navigations stop 4rem before the target element */
}

Quick facts

Initial value
See individual properties
Inherited
No
Applies to
scroll containers
Animation type
byComputedValueType

Values

auto

scroll-padding Browser Support

Widely available Since 2020 95% global usage

This feature is well established and works across many devices and browser versions. It has been available across browsers since 2020.

Safe to use without fallbacks.

69+
68+
14.1+
79+
ESC