~/css/scrollbar-generator
CSS Scrollbar Generator
Design a custom scrollbar and test it in a scrollable preview: set the width, track colour, thumb colour, hover colour and corner radius. The CSS covers WebKit browsers and the standard Firefox properties in one block.
Using the CSS Scrollbar Generator
Two ways to style scrollbars
Chrome, Edge and Safari use the ::-webkit-scrollbar pseudo-elements, which allow full control over width, colours and radius. Firefox and the CSS standard use scrollbar-width and scrollbar-color, which are simpler. The generated CSS includes both, so every browser gets a styled scrollbar.
Keep it usable
A scrollbar is a control, not just decoration. Keep the thumb clearly visible against the track and wide enough to grab. Very thin, low-contrast scrollbars look sleek but frustrate people with less precise mice and anyone with low vision.
Scoped or global
Styling only one scrolling panel, such as a sidebar or code block, is usually better than changing the scrollbar for the whole page. Tick "Apply to the whole page" if you do want a site-wide style.
Mobile behaviour
Phones and tablets use overlay scrollbars that appear only while scrolling and mostly ignore these styles. Custom scrollbars are a desktop refinement.
How wide should a custom scrollbar be?
Between 8 and 12 pixels is a common range. Narrower thumbs look neat but are hard to grab with a mouse, especially for people with limited motor control, so keep enough width and a clearly visible thumb colour.
Worked example: a scrollable chat panel
Scope the rules to the panel, not the whole page, give the track the panel's background colour and the thumb a mid-grey that darkens on hover. The scrollbar then blends in but still shows how far through the conversation you are.
Frequently asked questions
Why does Firefox look different?
Firefox only supports the standard properties: a thumb colour, a track colour and a thin or auto width. It does not support radius or hover colours.
Can I hide the scrollbar but keep scrolling?
Yes, with scrollbar-width: none and ::-webkit-scrollbar { display: none }, but make sure people can still tell the area scrolls.
Does this affect accessibility?
Only if the thumb becomes hard to see. Keep strong contrast between thumb and track.
Does scrollbar styling work on phones?
Mobile browsers mostly show their own overlay scrollbars that appear only while scrolling, so custom styles have little or no effect there. Design for desktop and let mobile behave natively.
What does scrollbar-gutter do?
scrollbar-gutter: stable reserves space for the scrollbar even when the content does not scroll, so the layout does not jump sideways when a scrollbar appears.