The scroll-padding-top property insets the scrollport at the top edge of a scroll container. It helps ensure content is not too close to the top when scrolling or scroll snapping.
01
top
Physical edge.
02
inset
Scrollport space.
03
length
px, rem, %.
04
container
On scroll box.
05
header
Top inset.
06
snap
First panels.
Fundamentals
Introduction
The scroll-padding-top property in CSS is part of the CSS Scroll Snap Module. It allows you to define inset at the top of a scroll container’s scrollport, ensuring that content is not too close to the top edge when it is scrolled into view.
This property is especially useful for improving readability and usability when fixed headers, sticky navigation, or browser chrome would otherwise cover snapped content.
Definition and Usage
Apply scroll-padding-top to the scroll container — such as html or an element with overflow: auto and scroll snapping enabled.
It is one longhand of the scroll-padding shorthand. Use it when only the top side of the scrollport needs inset.
💡
Beginner Tip
On a normal webpage, scroll-padding-top: 20px insets the top of the scrollport so the first snap item is not hidden under a fixed header.
Foundation
📝 Syntax
The syntax for the scroll-padding-top property is straightforward. It can be applied to any scroll container.
The default value of the scroll-padding-top property is auto, which means the user agent determines the padding based on its default settings unless you specify a length or percentage.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Default value
auto
Horizontal writing mode
Top scrollport inset
Part of
scroll-padding shorthand
Accepted values
Lengths, percentages, auto
Set on
Scroll containers
Inherited
No
Animatable
No
Reference
💎 Property Values
Value
Example
Description
length
scroll-padding-top: 50px;
Specifies a fixed amount of inset at the top edge (e.g., 20px, 2em).
percentage
scroll-padding-top: 10%;
Specifies inset as a percentage of the scroll container’s block dimension.
auto
scroll-padding-top: auto;
Lets the browser determine the padding automatically.
50px2rem10%
Context
When to Use scroll-padding-top
scroll-padding-top helps when the top side of the scrollport needs inset:
Fixed headers — Inset the scrollport so top content is not hidden under fixed UI.
First snap panel — Add space above the opening snap stop in a scroller.
Scroll containers — Prevent snapped content from sitting flush against the container top.
Overflow panels — Keep the first line of content visible below the scroll box edge.
For logical block-axis inset, consider scroll-padding-block-start instead. For the bottom edge, use scroll-padding-bottom.
Preview
👀 Live Preview
Scroll inside the box. The container uses scroll-padding-top: 2rem.
Content inside scrollport
Second panel
The scrollport is inset at the top edge so content stops below the container top.
Hands-On
Examples Gallery
Start with the reference vertical snap example, inset a snap scroller at the top, add page top inset for fixed headers, and use the longhand alone on a scroll box.
📜 Top Scrollport Inset
Inset the scrollport at the top edge inside a scroll container — matching the reference example.
Example 1 — scroll-padding-top on a scroll container
In this example, we’ll set the top scroll padding to 20px so content snaps with space at the top.
/* These are equivalent when only the top matters */.a{scroll-padding-top:2rem;}.b{scroll-padding:2rem000;}
🧠 How scroll-padding-top Works
1
Scroll container is configured
A scroll box with scroll-padding-top defines top inset for its scrollport.
Container
2
Top edge insets
The browser shrinks the effective snap area away from the container’s top edge.
Inset
3
Content scrolls into place
Snapped or scrolled content lands inside the inset scrollport at the top.
Position
=
★
Comfortable top stops
Opening content no longer feels cramped against the scrollport top.
Compatibility
Browser Compatibility
The scroll-padding-top 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.
✓ Logical scroll padding · Modern support
Reliable top support
Current Chrome, Firefox, Safari, Edge, and Opera support scroll-padding-top 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 top inset clears fixed headers or top UI.
scroll-padding-top property97% supported
Bottom line:scroll-padding-top is safe to use in modern projects for scroll containers that need top inset.
Wrap Up
Conclusion
The scroll-padding-top property is a valuable tool for enhancing the user experience with scroll snapping. By customizing the top padding, you can ensure content aligns properly within the viewport.
Adjusting the padding at the top of the scrollport helps prevent content from sitting under fixed headers and creates a smoother scrolling experience. Experiment with different padding values to see how this property can improve the usability of your web projects.
Use it with vertical snap scrollers and overflow panels
Match inset to fixed header or top toolbar height
Test first-panel snap behavior on mobile
Prefer scroll-padding-block-start when you need logical block-axis inset
❌ Don’t
Confuse it with padding-top layout spacing
Set it on snap targets instead of the scroll container
Use huge percentages without testing on small screens
Forget bottom inset when last panels need space too
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about scroll-padding-top
Use these points when insetting top scroll containers.
5
Core concepts
★01
auto Default
No inset.
Default
⚙02
top
Physical edge.
Axis
◉03
longhand
One side.
Detail
▦04
container
Scroll box.
Scope
▦05
snap
First panels.
Use case
🔄06
padding
Four sides.
Companion
❓ Frequently Asked Questions
scroll-padding-top insets the scrollport at the top edge of a scroll container. It creates space so scrolled or snapped content does not sit flush against the top of the viewport or overflow box.
scroll-padding-top always targets the physical top edge. scroll-padding-block-start is logical and follows the block axis, which may map differently in vertical writing modes.
scroll-padding is a shorthand for all four sides. scroll-padding-top sets only the top inset of the scrollport.
The default value is auto, meaning the browser applies no extra top inset unless you specify a length, percentage, or other value.
Use it on scroll containers when top content should not sit under fixed headers, browser chrome, or the container edge, such as for first snap panels or vertical overflow scroll boxes.