CSS Scrollbar Generator
- scrollbar-color and scrollbar-width
- ::-webkit-scrollbar fallback for older Safari
- Live preview with real scrolling
- Browser support beside the code
Controls
Browser support
Support data last reviewed .
What scrollbar-color does
Two standard properties now style scrollbars in every current browser. scrollbar-color sets the thumb and track colours, and scrollbar-width chooses auto, thin or none. Older Safari and Chrome only understand the non-standard ::-webkit-scrollbar pseudo-elements, so the generator adds those inside @supports not, where they cannot clash with the standard properties.
Syntax
scrollbar-color: <thumb> <track>; scrollbar-width: auto | thin | none;
| Part | What it controls |
|---|---|
| scrollbar-color | Two colours: the thumb first, then the track. Works in Chrome and Edge 121+, Firefox 64+ and Safari 26.2+. |
| scrollbar-width | auto, thin or none. none hides the scrollbar while keeping the element scrollable. Safari has supported it since 18.2. |
| scrollbar-gutter: stable | Reserves the scrollbar's space even when nothing overflows, so content does not jump when a scrollbar appears. |
| ::-webkit-scrollbar | The old WebKit pseudo-element for size. Chrome ignores it once the standard properties are set, so it only matters for older browsers. |
| ::-webkit-scrollbar-thumb | The draggable part. Radius and a border in the track colour make a floating pill. |
| ::-webkit-scrollbar-track | The groove the thumb moves in. |
| html | Use html as the selector to style the main page scrollbar rather than a single box. |
Notes from practice
The standard properties come first
Chrome 121 and later ignore ::-webkit-scrollbar rules on any element that sets scrollbar-color or scrollbar-width. Writing the WebKit rules inside @supports not (scrollbar-color: auto) keeps them for older browsers only.
Keep enough contrast
A pale thumb on a pale track is hard to find. Aim for clear contrast between thumb and track, especially for people with low vision, and avoid hiding scrollbars on content people must scroll.
Hiding is not removing
scrollbar-width: none hides the bar but the element still scrolls with a wheel, trackpad, touch or keyboard. Make sure something else shows that the content scrolls.
CSS Scrollbar Generator FAQ
How do I change the scrollbar color in CSS?
Use scrollbar-color with two colours, the thumb then the track, for example scrollbar-color: #2b5fe8 #e3e8f1. Put it on html for the page scrollbar or on any scrollable element. It works in current Chrome, Edge, Firefox and Safari.
How do I make a thin scrollbar?
Set scrollbar-width: thin. For older Safari and Chrome, add ::-webkit-scrollbar { width: 8px; } inside @supports not (scrollbar-color: auto). The generator writes both.
How do I hide the scrollbar but keep scrolling?
Use scrollbar-width: none on the scrollable element, plus ::-webkit-scrollbar { display: none; } for older Safari. The content still scrolls with a wheel, trackpad, touch or the keyboard.
Does Safari support scrollbar-color?
Yes, from Safari 26.2. Safari supported scrollbar-width earlier, from 18.2. For older Safari versions, the ::-webkit-scrollbar fallback in this generator styles the size and colours.
Why does my ::-webkit-scrollbar CSS no longer work in Chrome?
Since Chrome 121, setting scrollbar-color or scrollbar-width on an element makes Chrome ignore the ::-webkit-scrollbar rules for it. Use the standard properties as the main styling and keep the WebKit rules as a fallback.
Related generators
- Form Controls & Scrollbars — accent-color, caret-color, color-scheme, ::selection, ::placeholder, scrollbar styling and textarea behaviour.
- Scroll Snap — Make carousels and galleries lock to each slide. Swipe or scroll the preview to feel it.
- CSS Carousel — A carousel with no JavaScript: scroll snap for the slides, plus native ::scroll-button() arrows and ::scroll-marker dots.
- Modern Color Functions — oklch(), color-mix(), relative colour syntax and light-dark(), with an sRGB hex fallback where it applies.
More in UI & Interaction
Part of CSSGen.dev — 34 free visual CSS generators with browser support built in.