# How to Generate a Custom CSS Scrollbar

> Design custom scrollbar styles with a visual editor. Choose colors, width, and border radius to generate cross-browser CSS scrollbar code.

- URL: https://www.browserutils.dev/how-to/generate-css-scrollbar/
- Published: 2026-10-21
- Updated: 2026-07-02

---

## Step 1: Choose a scrollbar style

Select a base scrollbar style or start from scratch. Pick between thin, medium, or wide scrollbar profiles to match your design.

## Step 2: Set track and thumb colors

Use the color pickers to set the scrollbar track (background) and thumb (draggable handle) colors. You can also set a hover color for the thumb.

## Step 3: Adjust width and border radius

Control the scrollbar width and round the thumb corners with border radius. Thinner scrollbars feel more modern, while rounded corners soften the look.

## Step 4: Preview the scrollbar

See a live preview of your custom scrollbar in the preview pane. Scroll the sample content to verify the look and feel.

## Step 5: Copy the CSS code

Copy the generated CSS including both the WebKit pseudo-element syntax and the standard scrollbar-color and scrollbar-width properties.

Default browser scrollbars can clash with a carefully designed interface. The [CSS Scrollbar Generator](/tools/css-scrollbar-generator) lets you design custom scrollbars visually and export clean CSS that works across modern browsers, so your scrollable areas blend seamlessly with the rest of your UI.

## Understanding CSS scrollbar styling

CSS offers two approaches to scrollbar customization, and browser support differs between them.

The **WebKit/Blink approach** uses pseudo-elements like `::-webkit-scrollbar`, `::-webkit-scrollbar-track`, and `::-webkit-scrollbar-thumb`. This gives you granular control over every visual aspect of the scrollbar, including width, colors, border radius, and hover states. Chrome, Edge, Safari, and other WebKit-based browsers support these pseudo-elements.

The **standard approach** uses the `scrollbar-color` and `scrollbar-width` properties defined in the CSS Scrollbars Styling specification. Firefox supports these properties, and Chrome has added support as well. The standard properties are simpler but less flexible: `scrollbar-color` accepts two colors (thumb and track), and `scrollbar-width` accepts `auto`, `thin`, or `none`.

For maximum compatibility, use both approaches together. The WebKit pseudo-elements provide the detailed styling, while the standard properties serve as a fallback. Browsers apply whichever syntax they understand and ignore the other.

## Tips and best practices

- **Keep sufficient contrast between the thumb and track.** Users need to see the scrollbar to use it effectively. A thumb that blends into the track creates an accessibility problem.
- **Use `scrollbar-gutter: stable` to prevent layout shifts.** This property reserves space for the scrollbar even when content does not overflow, preventing the layout from jumping when content changes dynamically.
- **Avoid hiding scrollbars entirely** unless you provide an alternative scroll indicator. Setting `scrollbar-width: none` or `::-webkit-scrollbar { display: none }` removes a critical navigation cue, especially for users who rely on visual feedback.
- **Test on both macOS and Windows.** macOS hides scrollbars by default and shows them on scroll, while Windows displays them persistently. Your custom scrollbar may feel different across operating systems.

## Common issues

- **Custom scrollbar not appearing on macOS:** macOS overlay scrollbars take priority by default. Users with "Show scrollbars: Always" in System Preferences will see your custom styles, but others will see the native overlay scrollbar. The WebKit pseudo-elements override this behavior in most cases.
- **Scrollbar styles not applying in Firefox:** Firefox does not support `::-webkit-scrollbar` pseudo-elements. Make sure you include the standard `scrollbar-color` and `scrollbar-width` properties alongside the WebKit syntax.
- **Thumb appears too small on short content containers:** When the scrollable area is much larger than the container, the thumb shrinks proportionally. Set a `min-height` on `::-webkit-scrollbar-thumb` to ensure the thumb remains large enough to click and drag.