Scrollbar Styler

How to use 3 steps
  1. Set the Width and Thumb radius.
  2. Pick the Track colour, Thumb colour and hover colour.
  3. Choose where it applies under Apply to, then press Copy CSS.

Scroll this panel to see the styled scrollbar.

Every change below applies here immediately, using the same declarations printed in the CSS block.

The standard properties come first, then the WebKit pseudo-elements as a fallback for browsers that have not implemented them.

Firefox has supported scrollbar-width and scrollbar-color for years; Chrome and Safari added them more recently and still honour the pseudo-elements.

Keep the thumb and track far enough apart in contrast that the control stays visible — a scrollbar is an interactive element.

Scroll further.

And further still.

End of the sample content.

The standard scrollbar-width property accepts only auto, thin or none — not a length.
Generated CSS

Both syntaxes are written out because neither covers every browser on its own: scrollbar-width and scrollbar-color are the standard and are the only route in Firefox, while the ::-webkit-scrollbar pseudo-elements are the only way to set an exact pixel width or a corner radius. Where both apply, the standard properties win and the pixel width is ignored. Hiding a scrollbar entirely removes a visible affordance and is worth avoiding on anything a person needs to find.

How this tool works

Two different mechanisms are emitted together because neither one is enough on its own. The standard properties, scrollbar-width and scrollbar-color, are the only route Firefox offers, and they are deliberately limited: a keyword for the width and a pair of colours, nothing more. The WebKit pseudo-elements are the only way to set an exact pixel width or a corner radius, and they are what Chrome, Edge and Safari have understood for years.

The rule is scoped to whatever selector you enter, which matters more than it sounds: applied to the whole page a restyled scrollbar affects every reader, while scoped to one panel it affects only the component you meant. The preview drives its pseudo-elements through custom properties, because a pseudo-element cannot be reached from an element's inline style.

Restyling a control people rely on

  • A thin scrollbar is a smaller target: the standard thin keyword and a narrow pixel width both shrink the area a person has to hit with a mouse. On a control used for navigation that is a real cost, and it is worth leaving the default width on long pages.
  • Contrast between thumb and track is what makes it usable: a thumb that barely differs from its track disappears against the page. The 3:1 non-text minimum is the right target, since the thumb is a control rather than decoration.
  • The two syntaxes will not match exactly: Firefox rounds the width to its own idea of thin or auto and ignores the radius entirely, so the same rule looks slightly different across browsers by design rather than by fault.
  • Overlay scrollbars ignore most of this: macOS and touch devices hide the scrollbar until it is used and draw it their own way. Treat the styling as an enhancement on pointer devices, not as a layout you can depend on.

Two syntaxes, because neither is enough

The standard properties — scrollbar-width and scrollbar-color — are the only route Firefox offers, and they are deliberately limited: a keyword for the width, a pair of colours, nothing else. No radius, no exact pixel size, no separate hover state.

The WebKit pseudo-elements can set all of that, and Chrome, Edge and Safari have understood them for years.

So the [msm_tool slug="scrollbar-styler"] emits both, and the two will never look identical. Firefox rounds the width to its own idea of thin or auto and ignores the radius entirely. That is by design rather than a bug, and it is worth knowing before you spend time trying to reconcile them.

Scope it to a panel

The rule applies to whatever selector you give it, and that choice matters more than it sounds.

Applied to the whole page, a restyled scrollbar affects every reader on every screen. Applied to a code block, a sidebar or a scrolling table, it affects only the component you meant. The main page scrollbar is a control people rely on and have muscle memory for; there is rarely a good reason to redesign it.

A thin scrollbar is a smaller target

Both the thin keyword and a narrow pixel width shrink the area a person has to hit with a mouse. On a control used for navigation that is a genuine cost, not an aesthetic one.

Motor impairments make it worse, and so does a trackpad, and so does a large monitor where the scrollbar is a long way from the pointer. On long pages, leaving the default width is usually the right answer.

Contrast between thumb and track

The thumb is an interactive control, which means it is held to 3:1 against the track rather than to any decorative standard.

A thumb that barely differs from its track disappears against the page — and the fashionable version of this style, a very pale grey thumb on a white track, fails comfortably. If the scrollbar is worth styling at all, it is worth being visible.

Overlay scrollbars ignore most of it

macOS and touch platforms draw scrollbars as overlays that hide when idle and appear briefly during a scroll. They are drawn by the operating system in its own style, and most of what you set does not apply.

Treat scrollbar styling as an enhancement on pointer devices, not as a layout you can depend on. A design that only works when the scrollbar is a specific width will break on half the machines that visit it.

Do not hide it

It is possible to make a scrollbar invisible while keeping the element scrollable. It is almost always a mistake.

The scrollbar is the only indication that there is more content, and how much. Removing it means some users never discover the rest of a list, and it removes the ability to drag to a position. Horizontal carousels with hidden scrollbars are the usual offender: what reads as a clean design to the person who built it reads as a truncated list to someone who does not know to swipe.

If the scrollbar is visually intrusive, style it to be quieter. Do not remove it.

What is worth styling

  • Code blocks and pre elements — a default scrollbar inside a dark code block looks out of place, and this is the clearest case for restyling.
  • Dark-mode surfaces — a light system scrollbar on a dark panel is jarring, and scrollbar-color alone fixes it in every browser.
  • Scrolling panels inside an application shell — sidebars, drawers, data tables.

For the last two, scrollbar-color on its own is often the whole answer. It works everywhere, it needs no prefixed block, and it solves the actual complaint.

Frequently Asked Questions

Specific to the Scrollbar Styler. Broader questions about this category are answered on the category page.

Firefox understands only the standard properties, and only the WebKit pseudo-elements can set an exact width or radius. Shipping both covers every browser.
The standard property takes a keyword rather than a length, and has no radius at all. Firefox will honour the colours and pick its own width.
Usually not. Scope it to a panel or a code block. The main page scrollbar is a control people rely on, and a restyled one is one more thing that can go wrong.
At least 3:1 against the track. The thumb is an interactive control, so the non-text contrast minimum applies to it rather than a decorative standard.
Touch platforms draw overlay scrollbars their own way and hide them when idle. Scrollbar styling is a pointer-device enhancement.

Subscribe to receive notifications about new tools, features, and productivity tips.