The scroll-padding property insets the scroll snap area inside a scroll container. It is especially helpful for scroll snapping and page navigation when fixed headers or footers would otherwise hide snapped content at the container edges.
01
Container
Scrollport inset.
02
top
Clear fixed header.
03
length
px, rem, em.
04
snap
Vertical panels.
05
auto
Browser default.
06
margin
Companion prop.
Fundamentals
Introduction
The scroll-padding property in CSS is used to define the offset around the edges of a scroll container where the browser will stop scrolling when a user performs a scroll snap or navigates to a scroll destination.
This property helps control the positioning of content when using scroll snapping, ensuring that desired elements are fully visible and not obscured by other UI elements like fixed headers or footers.
Definition and Usage
Apply scroll-padding to the scroll container — such as html, an element with overflow: auto, or the element that has scroll-snap-type set.
Unlike regular padding, scroll-padding does not shift layout content. It only changes the inset of the scrollport where snapping and scroll positioning occur.
💡
Beginner Tip
If snapped sections hide under a fixed header, add scroll-padding-top: 50px on the scroll container to match the header height.
Foundation
📝 Syntax
The syntax for the scroll-padding property allows you to specify padding for one or more sides of the scroll container.
The scrollport inset scales with root font size, staying aligned with a rem-based header.
How It Works
rem keeps the container inset proportional when users change default text size settings.
Companion
scroll-padding vs scroll-margin
scroll-padding insets the scrollport on the container. scroll-margin offsets individual scroll targets. Both can solve fixed-header overlap — choose based on whether you control the container or each target.
A page or overflow box with scroll-padding defines inset edges for the scrollport.
Container
2
Scrollport edges inset
The browser shrinks the effective snap and scroll stop area away from the container edges.
Inset
3
Content snaps into place
Snapped items and scroll destinations land inside the padded scrollport instead of under fixed UI.
Position
=
★
Visible snap stops
Important content stays readable, even with fixed headers and footers.
Compatibility
Browser Compatibility
The scroll-padding property is supported in most modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. However, it is always a good practice to test your website across different browsers to ensure compatibility.
✓ Scrolling · Modern support
Reliable scroll-padding support
Current Chrome, Firefox, Safari, Edge, and Opera support scroll-padding on scroll containers.
97%Modern browser support
Google Chrome69+ · Desktop & Mobile
Full support
Mozilla Firefox68+ · Desktop & Mobile
Full support
Apple Safari14.1+ · macOS & iOS
Full support
Microsoft Edge79+ · Chromium
Full support
Opera56+ · Modern versions
Full support
Testing tip
Test scroll snapping on mobile browsers to confirm the container inset clears your fixed header height.
scroll-padding property97% supported
Bottom line:scroll-padding is widely available in modern browsers for scroll containers and snap layouts.
Wrap Up
Conclusion
The scroll-padding property is a valuable tool for enhancing the user experience when using scroll snapping on your web pages.
By controlling the padding around the edges of a scroll container, you can ensure that important content is not hidden and that the layout remains visually appealing. Experiment with different padding values to see how this property can improve the usability and aesthetics of your web projects.
Set scroll-padding-top on the scroll container to match fixed header height
Use it with scroll-snap-type for full-page snap layouts
Prefer rem when the header size is defined in rem
Pair with scroll-behavior: smooth for polished page navigation
Test snap panels inside nested overflow containers
❌ Don’t
Confuse scroll-padding with regular layout padding
Put scroll-padding on snap targets instead of the scroll container
Assume scroll-padding and scroll-margin are interchangeable
Use huge percentage values without testing on small screens
Forget to set padding on the element that actually scrolls
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about scroll-padding
Use these points when insetting scroll containers.
5
Core concepts
★01
0 Default
No offset.
Default
⚙02
top
Header fix.
Pattern
◉03
container
Not target.
Scope
▦04
auto
Browser calc.
Values
🔄05
margin
Target pair.
Companion
❓ Frequently Asked Questions
scroll-padding insets the scroll snap area inside a scroll container. It creates padding around the edges of the scrollport so snapped or scrolled content is not hidden under fixed headers or flush against container edges.
scroll-padding is set on the scroll container to inset the scrollport. scroll-margin is set on the target element being scrolled to. Both can solve header overlap, but at different levels.
Regular padding affects layout and shifts content inside the box. scroll-padding only changes where scrolling and scroll snapping stop relative to the container edges.
The default value is 0 on all sides, meaning no inset is applied to the scrollport.
Use scroll-padding-top on the scroll container when a fixed or sticky header would otherwise cover snapped sections or anchor destinations at the top of the viewport.