CKTIS / CSS
scroll-margin-inline-start — logical scrolling offset
scroll-margin-inline-start specifies an offset for an element's scrolling target area on the inline-start side. It does not create layout spacing, and its physical side depends on the writing direction.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
scroll-margin-inline-start: <length>;scroll-margin-inline-start offsets the inline-start edge of an element's scroll snap area. It also affects scrolling to the element without snapping enabled. Unlike margin-inline-start, it does not change layout; scroll-padding-inline-start, by contrast, is set on the scroll container.
It accepts a <length>, including negative values, but not percentages or auto. Its initial value is 0, and it is not inherited. A positive value expands the target area on that side.
This is a logical direction, not a fixed left edge: with writing-mode: horizontal-tb, inline-start is left for direction: ltr and right for direction: rtl. A vertical writing mode changes the axis mapping.
In the example, clicking Scroll to B should leave 24 CSS px before B without changing the items' layout. The expected scrollLeft is 176. The available scroll range can constrain the requested alignment, particularly near the ends of the content.
Examples
<!doctype html>
<meta charset="utf-8">
<title>scroll-margin-inline-start</title>
<style>
.scroller {
display: flex;
width: 240px;
overflow-x: auto;
direction: ltr;
writing-mode: horizontal-tb;
}
.item {
flex: 0 0 200px;
height: 80px;
background: #ddd;
}
#target {
scroll-margin-inline-start: 24px;
background: #9df;
}
</style>
<button id="go">Scroll to B</button>
<div class="scroller">
<div class="item">A</div>
<div class="item" id="target">B</div>
<div class="item">C</div>
</div>
<script>
document.getElementById('go').addEventListener('click', () => {
document.getElementById('target').scrollIntoView({
behavior: 'instant', block: 'nearest', inline: 'start'
});
});
</script>Result
After clicking “Scroll to B”: scroller.scrollLeft = 176; B starts 24 CSS px inside the scroller's left edge.
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.