4.5 · Responsive components
No more layout jumps: scrollbar-gutter
Reserve space for the scrollbar so content doesn’t shift when one appears.
With classic scrollbars, which are the default on Windows and Linux, a scrollbar takes up space. When content grows long enough to scroll, the scrollbar appears and everything shifts sideways.
scrollbar-gutter: stable reserves the space up front.
With overlay scrollbars, the macOS default, there’s nothing to reserve
and you won’t see a difference. Set scroll bars to “Always” in System
Settings to try it.
/* Always show a scrollbar, even if
there's nothing to scroll */
.box { overflow-y: scroll; }
.box {
overflow-y: auto;
scrollbar-gutter: stable;
}