Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

scrollbar-color — scrollbar colors

scrollbar-color specifies scrollbar thumb and track colors or leaves their selection to the browser.

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

Syntax

scrollbar-color: auto | <color>{2};

scrollbar-color accepts auto or exactly two colors: first the moving thumb, then the track. A single color is invalid.

Initially auto, it is inherited. It applies to scroll containers but does not enable scrolling. The root element’s value applies to the viewport; body has no such special propagation.

Ensure thumb/track contrast. Appearance depends on platform and user preferences; some parts may be absent. A non-auto value overrides alternative nonstandard scrollbar styling mechanisms.

The example creates an overflowing panel. Verify scrolling and color order locally; an overlay scrollbar may appear only during interaction.

Examples

<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>scrollbar-color demo</title>
<style>
  .panel {
    width: 240px;
    height: 120px;
    overflow: auto;
    scrollbar-color: #243746 #eeeeee;
  }
  .content {
    height: 360px;
    background: linear-gradient(white, #cccccc);
  }
</style>
<div class="panel" tabindex="0" aria-label="Scrollable example">
  <div class="content">Scroll this panel.</div>
</div>
</html>

Result

A 240 × 120 CSS-pixel panel containing 360 CSS-pixel-tall content. Where supported and visible, the scrollbar uses #243746 for its thumb and #eeeeee for its track; exact rendering depends on platform and user preferences.

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