CSS scrollbars styling

The CSS scrollbars styling module defines properties that you can use for visual styling of scrollbars. You can customize the scrollbar width as needed. You can also customize the scrollbar track color (the background) and the scrollbar thumb color (the draggable handle).

Scrollbar styling in action

This example defines a thin scrollbar with a teal thumb and lighter teal track. To see the thumb, scroll the text. After the scrollbar is visible, hover over it to see the track.

css
.poem {
  overflow: scroll;
  scrollbar-color: #0b4f4a #5f9e98;
  scrollbar-width: thin;
}

Note: When customizing scrollbars, ensure that the thumb and track have enough contrast with the surrounding background. Also ensure that the scrollbar hit area is large enough for people who use touch input.

Reference

CSS properties

Specifications

Specification
CSS Scrollbars Styling Module Level 1

See also