Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

scrollbar-gutter — reserving scrollbar space

The `scrollbar-gutter` property reserves space for classic scrollbars, helping prevent layout shifts.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

scrollbar-gutter: auto | stable && both-edges?;

scrollbar-gutter applies to scroll containers, is not inherited, and initially equals auto. It controls space at inline edges, not scrollbar visibility.

auto reserves space for classic scrollbars when required by overflow. stable preserves it with overflow: auto, scroll, or hidden, even without overflow; not with visible or clip.

stable both-edges adds matching space opposite the scrollbar. both-edges alone is invalid. Overlay scrollbars create no gutters. Width depends on the environment. To affect the document viewport, set the property on the root element, not body.

Examples

<!doctype html>
<meta charset="utf-8">
<title>scrollbar-gutter</title>
<style>
  .panel {
    box-sizing: border-box;
    width: 240px;
    height: 100px;
    overflow: auto;
    scrollbar-gutter: stable both-edges;
    border: 1px solid;
    background: #eee;
  }
  .content {
    height: 40px;
    background: #bde;
  }
  .panel:hover .content {
    height: 200px;
  }
</style>
<div class="panel" tabindex="0">
  <div class="content">Content</div>
</div>

Result

Classic scrollbars: matching inline gutters remain reserved before and during hover. Overlay scrollbars: no gutters are reserved. Hover increases content height from 40px to 200px, producing vertical overflow.

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources