CKTIS / CSS
scroll-padding-block — inset the scrolling target region
scroll-padding-block sets optimal viewing region offsets at the start and end of a scroll container's block axis without changing element layout.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
scroll-padding-block: [ auto | <length-percentage [0,∞]> ]{1,2};scroll-padding-block is shorthand for scroll-padding-block-start and scroll-padding-block-end. One value sets both sides; two specify start then end. Apply it to the scroll container.
Values accept nonnegative lengths, percentages, and auto (the initial, browser-determined value). Percentages reference the corresponding scrollport dimension. The property is not inherited.
Sides depend on writing-mode: horizontal-tb maps them to top and bottom, while vertical-rl maps them to right and left. Do not assume the block axis is always vertical.
These offsets neither create space like padding nor change layout. They affect the scrolling target region; with scroll snapping, they define the snapport edges. Enabling scroll snapping is not required.
Examples
<!doctype html>
<meta charset="utf-8">
<title>scroll-padding-block</title>
<style>
#scroller {
writing-mode: horizontal-tb;
height: 160px;
width: 240px;
overflow: auto;
scroll-padding-block: 24px 12px;
border: 1px solid;
}
.space { height: 240px; }
#target { height: 40px; background: lightblue; }
</style>
<div id="scroller">
<div class="space"></div>
<div id="target">Target</div>
<div class="space"></div>
</div>
<pre id="result"></pre>
<script>
const scroller = document.getElementById('scroller');
const target = document.getElementById('target');
target.scrollIntoView({ block: 'start', behavior: 'instant' });
document.getElementById('result').textContent =
`scrollTop: ${scroller.scrollTop}`;
</script>Result
scrollTop: 216
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.