The scroll-margin-top property sets the scroll margin on the physical top edge of a snap target. That outset enlarges the scroll snap area used when this box snaps to the snapport.
It always means “top,” no matter the writing mode. It is not inherited. The initial value is 0. It is one longhand of scroll-margin. Pair it with scroll-snap-type and scroll-snap-align. A common use is leaving room under a fixed header for in-page anchors.
Physical longhand.
Standard-track and Baseline Widely available. Prefer scroll-margin-block-start when writing mode may change. It accepts a length only — not a percentage.
Non-standard alias (legacy).
Older Safari used scroll-snap-margin-top. Prefer the standard scroll-margin-top name in new code.
scroll-padding-top insets the container’s snapport. This property expands the target’s snap area.
Compatibility
Browser Support
scroll-margin-top is a browser layout property for scroll snap. Node.js, Deno, and Bun do not apply it.
✓ Baseline · Widely available since 2021
scroll-margin-top
Chrome 69+, Firefox 68+, Safari 14.1+, Edge 79+, Opera 56+, Samsung Internet 10.1+. Internet Explorer does not support it.
97%Modern browsers
Google Chrome69+
Full support
Mozilla Firefox68+
Full support
Apple Safari14.1+
Full support
Microsoft Edge79+
Full support
Opera56+
Full support
Samsung Internet10.1+
Full support
Internet ExplorerNo support
Not supported
scroll-margin-topWidely supported
Bottom line: Safe for modern scroll-snap UIs. Skip Internet Explorer. Pair with scroll-snap-type and usually scroll-snap-align: start.
Remember
Key Takeaways
Role: set a scroll margin on the physical top edge of a snap target only.
Values: lengths such as 40px or 1rem. No percentages.
Initial value:0. Not inherited. Part of the scroll-margin shorthand.
Tip: pair with scroll-snap-align: start so the top outset is easy to see.
One line:scroll-margin-top gives a snap target breathing room on its top edge — after scroll snap is already set up.
Frequently Asked Questions
It sets the scroll margin on the physical top edge of a snap target. That outset enlarges the scroll snap area so snapping can stop a little before the top edge.
The initial value is 0. There is no extra top outset until you set one.
It mainly affects scroll snapping. You still need a scroll container with scroll-snap-type and a target with scroll-snap-align for the offset to show during snap scrolling. It is also useful for in-page anchors under a fixed header.
scroll-margin-top always targets the physical top side. scroll-margin-block-start follows the writing mode and may map to top or another edge.
No. Set it on the element that snaps. Percentages are not valid; use lengths such as px, rem, or em.
It is Baseline and widely available: Chrome 69+, Firefox 68+, Safari 14.1+, Edge 79+, Opera 56+. Internet Explorer does not support it. It is a browser layout property, not a Node.js feature.