CSS scroll-margin-block-start Property
Description
The scroll-margin-block-start property lets authors control the offset used when an element is brought into view along the block axis of the writing mode. When a scrolling operation targets an element — for example, programmatic scrolling (like calling scrollIntoView), following an in-page anchor, focusing an element that causes scrolling, or a scroll snap destination — the browser calculates the position where that element should end up in the scrollport; scroll-margin-block-start adds extra space between the element’s start edge in the block direction and the start edge of the scrollport so the element is not flush against the container edge. This adjustment affects the final scrolled position rather than element geometry during normal layout.
Because it is a scroll-offset property, scroll-margin-block-start does not participate in box model calculations, margin collapsing, or flow layout. Changing it does not move other elements or change the element’s position in its container; it only alters how the scroller positions the element when bringing it into view. For broader control of scroll offsets you can use the related shorthand scroll-margin to set offsets on multiple logical sides at once, and for manipulating the scroller’s own inset you can look at scroll-padding, which affects how the scrollport determines snap and visible edges.
Because this is a logical property it follows writing-mode and direction: "block-start" maps to the physical top/left/right/bottom depending on whether text flows horizontally or vertically and on the writing-mode and direction of the element. This makes it convenient for international layouts where the physical edge you want to offset changes with the writing system. If you need a similar visual spacing that actually participates in layout you might consider margin-block-start instead, but remember that margin-block-start alters layout and flow while scroll-margin-block-start only alters scrolling behavior. For scroll snapping scenarios, this property can be combined with snap alignment logic (see scroll-snap-align) to ensure snap targets land a comfortable distance from the container edge rather than being hidden under fixed headers or other UI chrome.
Practical uses include keeping focused form controls or navigated-to headings visible beneath a persistent header, improving keyboard and assistive technology behavior by ensuring content appears with an appropriate visual buffer, and fine-tuning the perceived position of snap points. Because it is scoped to the element being targeted and not the container, you can selectively give particular items extra offset (for example, the first item of a section) without altering the global scroll-port insets.
Definition
- Initial value
- 0
- Applies to
- all elements
- Inherited
- no
- Computed value
- as specified
- Animatable
- by computed value type
- JavaScript syntax
- object.style.scrollMarginBlockStart
Interactive Demo
Syntax
scroll-margin-block-start: <length>
Values
- <length>An outset from the block end edge of the scroll container.
Example
Browser Support
The following information will show you the current browser support for the CSS scroll-margin-block-start 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
