How to use the scrollbar styler
- Choose the scope: one element (with your own class name) or the whole page.
- Set the size: the pixel width for Chrome, Edge and Safari, and thin, normal or hidden for Firefox.
- Shape the thumb with a corner radius and an inset, which draws a track-colored border so the thumb looks like it floats.
- Pick colors: thumb, thumb on hover, track and the content background.
- Scroll the preview to try it, then export CSS, SCSS or a Tailwind utilities layer.
How it works
@supports not selector(::-webkit-scrollbar) {
.scroll-area { scrollbar-width: thin; scrollbar-color: #64748B #E2E8F0; }
}
.scroll-area::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll-area::-webkit-scrollbar-thumb { background: #64748B; border: 2px solid #E2E8F0; border-radius: 999px; }
For the whole page, the WebKit pseudo-elements are written without a selector, so they apply to the document scrollbar.
Worked examples
Example 1: a chat sidebar
Load Minimal for a narrow conversation list. The 8px thumb is unobtrusive but still easy to drag.
Example 2: a dark code panel
Load Dark or Terminal for code blocks and consoles on dark backgrounds. The track blends into the panel, and the thumb has enough contrast to see your position.
Example 3: a branded page
Load Page thin and change the thumb to your brand color. Keep the track close to the page background so the scrollbar doesn’t dominate.
Tips
- Scrollable regions should be focusable (
tabindex="0") with an accessible name, so keyboard users can scroll them. - Test on macOS, where scrollbars hide until you scroll, depending on system settings.
- Keep the hover color clearly different, so people know they can grab it.
Common mistakes
- Removing the scrollbar on the page. People lose the visual cue of how long the page is.
- Low-contrast thumbs. A light grey thumb on a white track is nearly invisible. Aim for 3:1.
- Only styling WebKit. Firefox ignores
::-webkit-scrollbar; the standard properties cover it. - Thin bars on touch devices. Mobile browsers use overlay scrollbars anyway, so focus your styling on desktop.
For horizontal scrollers such as tables or code blocks, the same height value controls the horizontal bar, so check both directions in the preview before shipping.