CSS scroll-margin-left Property
Description
The scroll-margin-left property defines an offset that adjusts where an element should land relative to the left edge of its nearest scroll container when it is scrolled into view. Rather than changing the box model or the element’s position in layout, it influences scroll destination calculations so the element can stop some distance away from the container’s left edge instead of flush against it.
This property is a scroll-positioning hint used by user-driven and programmatic scrolling (for example, fragment navigation or Element.scrollIntoView) and by scroll snap operations. It does not change how the element occupies space or how other elements flow around it; it only affects the computed final scroll position. It commonly pairs with snap alignment behavior—see scroll-snap-align—and is often used alongside container-side spacing controls such as scroll-padding-left to produce consistent visual gaps when snapping or navigating.
Because "left" is a physical direction, consider logical alternatives when supporting different writing modes or directionality. For inline-start relative control you can use the logical counterpart scroll-margin-inline-start. Also note the distinction from layout margins: unlike margin-left, scroll-margin-left does not affect hit testing, stacking context, or layout reflow — it only modifies scroll calculations and the final viewport alignment of the element.
In practical use, scroll-margin-left is handy for keeping important content (such as headings, focused elements, or anchored sections) visible and not obscured by fixed sidebars or edge decorations when jumped to. It creates "breathing room" at the left edge of the scroller without altering document flow, improving usability and visual comfort during navigations and snap-driven scrolling.
Definition
- Initial value
- 0
- Applies to
- all elements
- Inherited
- no
- Computed value
- as specified
- Animatable
- by computed value type
- JavaScript syntax
- object.style.scrollMarginLeft
Interactive Demo
Syntax
scroll-margin-left: <length>
Values
- <length>An outset from the bottom edge of the scroll container.
Example
Browser Support
The following information will show you the current browser support for the CSS scroll-margin-left 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
