CKTIS / CSS
scroll-padding-inline — inset the scrolling target region
Sets logical insets for the scrolling target region at the start and end of a container’s inline axis.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
scroll-padding-inline: [ auto | <length-percentage [0,∞]> ]{1,2};scroll-padding-inline abbreviates scroll-padding-inline-start and scroll-padding-inline-end. One value sets both ends; two specify start then end. Physical sides depend on writing-mode and direction.
It accepts auto or nonnegative lengths and percentages, relative to the scrollport’s inline dimension. Initially auto, it lets the browser determine the inset, usually zero. It is not inherited.
Apply it to the scroll container. It changes the scrolling and snapping target region, not layout or ordinary padding. It works without snapping. In contrast, scroll-margin-inline sets offsets on the target element.
Examples
<!doctype html>
<meta charset="utf-8">
<title>scroll-padding-inline</title>
<style>
#scroller {
width: 300px;
overflow: auto;
display: flex;
direction: ltr;
writing-mode: horizontal-tb;
scroll-padding-inline: 40px 20px;
}
#scroller > div {
flex: 0 0 200px;
height: 80px;
background: lightblue;
}
#target { background: gold !important; }
</style>
<button id="show">Show B</button>
<div id="scroller">
<div>A</div><div id="target">B</div><div>C</div>
</div>
<pre id="result"></pre>
<script>
const scroller = document.getElementById('scroller');
const target = document.getElementById('target');
document.getElementById('show').onclick = () => {
target.scrollIntoView({behavior: 'instant', block: 'nearest', inline: 'start'});
document.getElementById('result').textContent =
`scrollLeft: ${scroller.scrollLeft}`;
};
</script>Result
scrollLeft: 160
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.