Advertisement
Guide
About the Custom Scrollbar Styler
Browsers offer two ways to style scrollbars. The standard properties, scrollbar-color and scrollbar-width, set colours and a thin or normal width in every modern browser. The older ::-webkit-scrollbar pseudo-elements allow much more — exact width, rounded thumbs, hover colours — but only in Chromium browsers and Safari.
The detailed output uses the pseudo-elements and falls back to the standard properties only in browsers that lack them, so everyone gets the best version their browser supports.
Why not just set both?
Since Chrome 121, setting scrollbar-color or scrollbar-width on an element makes Chrome ignore its ::-webkit-scrollbar rules. Wrapping the standard properties in @supports not selector(::-webkit-scrollbar) keeps them for Firefox without switching off the detailed styling elsewhere.
Keep scrollbars usable
A scrollbar is a control as well as an indicator. Keep enough contrast between thumb and track, and avoid making it so thin that it is hard to grab with a mouse. Hiding scrollbars entirely is best limited to small horizontal strips where swiping is obvious.
How to use it
- 1Pick a preset or choose your colours.
- 2Set width, radius and spacing.
- 3Apply it to the whole page or a class.
- 4Copy the CSS into your stylesheet.
Frequently asked questions
Does custom scrollbar CSS work in Firefox?
Firefox supports the standard scrollbar-color and scrollbar-width properties, so you get your colours and a thin or normal width, but not rounded thumbs or hover colours.
How do I hide the scrollbar but keep scrolling?
Use scrollbar-width: none plus ::-webkit-scrollbar { display: none } — the “Hide scrollbar” tab has the snippet.
How do I style the scrollbar of one element only?
Choose “Elements with a class”, then add that class to any scrollable element.
Why does the page scrollbar not change?
For the whole page, the rules must target html (as generated). Some layouts scroll a wrapper element instead; apply the class to that element.
Do custom scrollbars work on phones?
Mobile browsers use thin overlay scrollbars that appear only while scrolling, and mostly ignore these styles.
