🎨 CSS & Design

Custom Scrollbar Generator

Design a custom scrollbar and get CSS that works in every browser.

  • 4–24 pxwidth
  • 3 colourstrack, thumb, hover
  • 2 syntaxesWebKit + standard
  • Livepreview

Scroll me ↓

Paragraph 1. Custom scrollbars help a scrolling panel match your brand — sidebars, chat windows, code blocks and dropdown menus. Keep the thumb easy to see and grab.

Paragraph 2. Custom scrollbars help a scrolling panel match your brand — sidebars, chat windows, code blocks and dropdown menus. Keep the thumb easy to see and grab.

Paragraph 3. Custom scrollbars help a scrolling panel match your brand — sidebars, chat windows, code blocks and dropdown menus. Keep the thumb easy to see and grab.

Paragraph 4. Custom scrollbars help a scrolling panel match your brand — sidebars, chat windows, code blocks and dropdown menus. Keep the thumb easy to see and grab.

Paragraph 5. Custom scrollbars help a scrolling panel match your brand — sidebars, chat windows, code blocks and dropdown menus. Keep the thumb easy to see and grab.

Paragraph 6. Custom scrollbars help a scrolling panel match your brand — sidebars, chat windows, code blocks and dropdown menus. Keep the thumb easy to see and grab.

↔ This line is extra wide so the horizontal scrollbar appears too ———————————————————————————————————

    

How to use the Custom Scrollbar Generator

  1. 1

    Scroll the demo box

    The preview panel scrolls both ways so you see vertical and horizontal bars.

  2. 2

    Set size and shape

    Choose width, thumb radius and thumb padding with the sliders.

  3. 3

    Pick colours

    Set the track, the thumb and the colour the thumb turns on hover.

  4. 4

    Choose the scope and copy

    Apply to a .scroll-box class or the whole page, then copy the CSS.

Features

Live preview

Every change is applied to the demo box instantly.

Hover colour

A separate colour for the thumb under the pointer.

Floating thumb

Padding creates a gap between thumb and track.

Firefox fallback

Standard scrollbar-color and scrollbar-width included.

Scoped or global

Style one component or the whole page.

Copy-ready CSS

Paste straight into your stylesheet.

Who uses it — and for what

Chat and sidebars

Slim scrollbars for panels inside apps.

Dark themes

Avoid bright default scrollbars on dark pages.

Dashboards and tables

Visible horizontal bars for wide tables.

Code blocks

Match scrollbars to a syntax theme.

Two syntaxes, one result

Chrome, Edge and Safari style scrollbars with the ::-webkit-scrollbar pseudo-elements (track, thumb, hover states, rounded corners). Firefox uses the standard scrollbar-width and scrollbar-color properties, which allow only the colours and a thin/auto width. Recent Chrome versions also understand the standard properties — and when they are set, Chrome ignores the webkit styles. The generated code therefore wraps the standard properties in @supports not selector(::-webkit-scrollbar) so every browser gets the richest style it supports.

Keep scrollbars usable

The “thumb padding” option draws a border in the track colour around the thumb, giving it a floating look without making it harder to grab. Keep enough contrast between thumb and track, avoid widths under 6px on touchpads, and never hide the scrollbar on content people need to scroll — on phones the system overlay scrollbar is used anyway, so these styles mostly affect desktop.

Everything updates live as you drag — copy the code when it looks right. Nothing is uploaded and there is no sign-up.

Class scope vs whole page

With A class (.scroll-box), the rules apply only to elements with that class — add class="scroll-box" to your chat panel or sidebar and give it a height and overflow: auto. With Whole page, the WebKit rules are written without a selector, which means they style every scrollbar on the page in Chrome, Edge and Safari, including inner panels. In Firefox the standard properties are set on html; the colours are inherited by inner scroll areas, while the width setting is not, so inner panels keep the default width there.

Why the @supports wrapper matters

Chromium browsers now understand the standard scrollbar-color and scrollbar-width properties as well as the older pseudo-elements. When both are present on an element, Chromium follows the standard properties, which means rounded corners, padding and hover colours would be lost. The generated code puts the standard properties inside @supports not selector(::-webkit-scrollbar), so browsers that understand the WebKit pseudo-elements use the richer version and only the others — Firefox — use the standard fallback. If a framework or reset elsewhere in your CSS sets scrollbar-color globally, it will still override your custom bar in Chromium; search your stylesheets for it if the style doesn’t show.

Extra polish you can add by hand

  • ::-webkit-scrollbar-corner styles the small square where a vertical and a horizontal bar meet; give it the track colour.
  • scrollbar-gutter: stable reserves space for the bar so content doesn’t shift when a panel starts scrolling; check browser support for your audience.
  • Use the Contrast Checker to make sure the thumb stands out against the track — a faint thumb is hard to find for people with low vision.

Worked examples

The default output for a class

With width 12, radius 8 and padding 2, the WebKit part sets .scroll-box::-webkit-scrollbar { width: 12px; height: 12px; }, colours the track #eef2f7, and gives the thumb background: #6366f1; border-radius: 8px; border: 2px solid #eef2f7; — the border in the track colour is what makes the thumb look inset. The Firefox block sets scrollbar-width: auto and scrollbar-color: #6366f1 #eef2f7.

A slim dark-mode bar

Width 6, track #0f172a, thumb #334155, hover #475569, radius 6, padding 0. Because the width is 8 px or less, the Firefox part switches to scrollbar-width: thin, the closest standard equivalent.

Pro tips

  • Widths of 8–12 px are easy to grab with a mouse; very thin bars suit touch-first or minimal designs only.
  • Set the hover colour a shade darker than the thumb so people get feedback before they drag.
  • macOS hides scrollbars by default unless a mouse is connected or the setting is changed — test on Windows too.

Glossary

Track
The groove the scrollbar thumb moves along.
Thumb
The draggable part of the scrollbar whose size shows how much content there is.
Pseudo-element
A CSS selector such as ::-webkit-scrollbar that targets part of an element.
@supports
A CSS rule that applies styles only when the browser supports a feature.

Frequently asked questions

Why doesn’t my custom scrollbar show in Chrome?

If scrollbar-color or scrollbar-width is set on the same element, Chrome uses those instead of ::-webkit-scrollbar.

Can I style scrollbars on mobile?

Mobile browsers use thin overlay scrollbars that ignore most styling.

How do I hide a scrollbar but keep scrolling?

scrollbar-width: none plus ::-webkit-scrollbar { display: none } — but only do it when scrolling is obvious.

Why does Firefox show a plain scrollbar?

Firefox only supports colours and a thin or auto width; radius, padding and hover are WebKit-only features.

Does “Whole page” also style scroll boxes inside the page?

Yes in Chrome, Edge and Safari. In Firefox the colours carry over but the width does not.

Will this affect performance?

No noticeable effect — these are simple styles applied by the browser.

Found it useful? Share the Custom Scrollbar Generator:

Last updated 2026-11-21 · Built by Vinayak Agarwal · Part of CSS & Design (37 tools)