CKTIS / CSS
scroll-margin-inline-end — inline-end scroll outset
scroll-margin-inline-end sets an outset on the inline-end side of an element's scroll alignment area. It does not add an ordinary margin or change layout.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
scroll-margin-inline-end: <length>;scroll-margin-inline-end modifies the element's area used for scroll snapping and scrolling into view. Set it on the target element; scroll-padding-inline-end instead concerns the scroll container.
The inline-end side depends on writing-mode and direction. With horizontal-tb, it is right for ltr and left for rtl; in vertical writing modes, the inline axis is vertical. This property is therefore not a fixed equivalent of scroll-margin-right.
The value is a length, such as 24px; negative values are allowed, but percentages and auto are not. The initial value is 0; the property is not inherited and does not change layout. It does not enable snapping by itself.
The example uses inline: 'end' without snapping. The result scrollLeft: 124 was verified in an isolated environment.
Examples
<!doctype html>
<meta charset="utf-8">
<title>scroll-margin-inline-end</title>
<style>
#scroller {
width: 300px;
overflow-x: auto;
writing-mode: horizontal-tb;
direction: ltr;
}
#track { display: flex; width: 900px; }
.item { flex: 0 0 200px; height: 80px; background: lightgray; }
#target { background: lightblue; scroll-margin-inline-end: 24px; }
</style>
<div id="scroller">
<div id="track">
<div class="item">A</div>
<div class="item" id="target">B</div>
<div class="item">C</div>
</div>
</div>
<pre id="result"></pre>
<script>
const scroller = document.getElementById('scroller');
const target = document.getElementById('target');
target.scrollIntoView({ behavior: 'instant', block: 'nearest', inline: 'end' });
requestAnimationFrame(() => {
document.getElementById('result').textContent =
`scrollLeft: ${scroller.scrollLeft}`;
});
</script>Result
scrollLeft: 124
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.