How to Customize Scrollbar Styles with CSS
Default browser scrollbars are functional but visually inconsistent and often clash with custom-designed interfaces โ especially dark-themed ones. CSS lets you customize scrollbar width, colors, and shape to match your design. Two approaches cover all modern browsers.
The Standard Properties (Now in Every Major Engine)
CSS Scrollbars Level 1 defines two properties: scrollbar-width (auto, thin or none) and scrollbar-color (thumb color, then track color). Firefox has supported them since version 64; Chrome and Edge added them in version 121 (January 2024) and Safari in 26.2 (December 2025), per MDN's compatibility data checked October 13, 2026.
The ::-webkit-scrollbar Pseudo-elements
The older, non-standard ::-webkit-scrollbar family still works in Chromium and Safari and gives finer control โ exact pixel width, rounded thumbs, hover states:
Combining Them: the Rule That Changed in Chrome 121
The usual "cross-browser" advice is to set both. Since Chrome 121, that silently drops your WebKit styling: when scrollbar-width or scrollbar-color applies to an element, Chromium ignores ::-webkit-scrollbar for it. We measured the rendered scrollbar width in Chromium 141 (headed, classic scrollbars, script in our test folder):
| CSS on the scroll container | Scrollbar width |
|---|---|
| Nothing (browser default) | 15 px |
::-webkit-scrollbar { width: 20px } only | 20 px |
scrollbar-width: thin only | 10 px |
| Both together (the common snippet) | 10 px โ the 20px WebKit rule was ignored |
So choose per element. If the standard properties are enough, use only them. If you want the WebKit look where it is available and the standard properties elsewhere, put the standard ones behind a feature query that excludes browsers which also support ::-webkit-scrollbar, or accept the standard look everywhere โ the simplest option now that all engines support it.
Whichever you choose, keep the thumb visible. A very common dark-theme pair, thumb #1A1D2E on track #0B0D17, has a contrast ratio of just 1.16:1; the #5A6178 thumb above gives 3.15:1 against the same track, enough to find it at a glance.
Hiding Scrollbars (While Keeping Scroll)
To hide scrollbars but keep the content scrollable:
.no-scrollbar { scrollbar-width: none; } /* Firefox */
.no-scrollbar::-webkit-scrollbar { display: none; } /* Chrome */Use this sparingly โ hidden scrollbars remove a visual affordance that tells users the content is scrollable. It works best for horizontal carousels and custom scroll containers where alternative navigation is provided.
Frequently Asked Questions
How do I change scrollbar color in CSS?
Can I hide scrollbars with CSS?
Are custom scrollbars accessible?
- [1]W3C CSS Scrollbars Styling Module Level 1: scrollbar-color and scrollbar-width โ
- [2]MDN Browser Compatibility Data: scrollbar-color (Firefox 64, Chrome 121, Safari 26.2; checked Oct 13, 2026) โ
- [3]Chrome for Developers: Scrollbar styling (standard properties in Chrome 121) โ
- [4]MDN Web Docs: ::-webkit-scrollbar (non-standard) โ
- [5]W3C WCAG 2.2: Understanding SC 1.4.11 Non-text Contrast โ