CSSApril 2026 ยท 5 min read

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.

๐Ÿ“œ
Try the Scrollbar Styler
Free, no signup
โ†’
DG
Derek Giordano
Designer & Developer
In this guide
01WebKit Scrollbar Styling (Chrome, Edge, Safari)02Firefox Scrollbar Styling03Cross-Browser Solution04Hiding Scrollbars (While Keeping Scroll)
โšก Key Takeaways
  • Style browser scrollbars with CSS.
  • Covers webkit scrollbar styling (chrome, edge, safari).
  • Covers firefox scrollbar styling.
  • Covers cross-browser solution.
  • Covers hiding scrollbars (while keeping scroll).

WebKit Scrollbar Styling (Chrome, Edge, Safari)

Chrome, Edge, and Safari support ::-webkit-scrollbar pseudo-elements:

::-webkit-scrollbar { width: 8px; }

::-webkit-scrollbar-track { background: #0B0D17; }

::-webkit-scrollbar-thumb { background: #1A1D2E; border-radius: 4px; }

::-webkit-scrollbar-thumb:hover { background: #2A2D3E; }

This gives you full control over the scrollbar's width, track color, thumb color, border-radius, and hover state.

Firefox Scrollbar Styling

Firefox uses the standard scrollbar-width and scrollbar-color properties:

๐Ÿ’ก Tip
Use gap instead of margin hacks for flexbox spacing. It keeps layout code cleaner and is supported in all modern browsers.

* {

scrollbar-width: thin;

scrollbar-color: #1A1D2E #0B0D17;

}

scrollbar-width accepts auto, thin, or none. scrollbar-color takes two values: thumb color and track color. Less control than WebKit, but it's the standards-based approach.

Cross-Browser Solution

Combine both approaches for full coverage:

โš  Warning
Avoid animating width, height, top, or left. These trigger layout recalculations on every frame and can drop performance below 60fps.

/* Firefox */

* { scrollbar-width: thin; scrollbar-color: #1A1D2E #0B0D17; }

/* Chrome, Edge, Safari */

::-webkit-scrollbar { width: 6px; }

::-webkit-scrollbar-track { background: #0B0D17; }

::-webkit-scrollbar-thumb { background: #1A1D2E; border-radius: 3px; }

The Scrollbar Styler generates this cross-browser CSS with a visual preview.

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?+
For Firefox: scrollbar-color: thumbColor trackColor. For Chrome/Edge/Safari: use ::-webkit-scrollbar-thumb and ::-webkit-scrollbar-track with background properties.
Can I hide scrollbars with CSS?+
Yes. scrollbar-width: none (Firefox) and ::-webkit-scrollbar { display: none } (Chrome/Safari) hide scrollbars while keeping content scrollable. Use with caution โ€” it removes a scroll affordance.
Are custom scrollbars accessible?+
Custom-styled scrollbars are functional and accessible as long as they remain visible and have sufficient contrast. Avoid hiding scrollbars entirely unless alternative scroll indicators are provided.
Try it yourself

Use the Scrollbar Styler โ€” free, no signup required.

โšก Open Scrollbar Styler
DG
Derek Giordano
Written by the creator of Ultimate Design Tools. BA in Business Marketing.