The CSS Scrollbar Generator styles the scrollbar of a scrollable element to match your site, replacing the default grey bar with colours and rounding chosen to suit your design. Scrollbars are easy to overlook, but they appear on long pages, chat panels, code blocks, and sidebars, and a scrollbar that matches the surrounding design makes the whole interface feel considered. A branded thumb colour and a soft track can turn a utilitarian control into a quiet detail that reinforces the palette.
Styling scrollbars by hand is awkward because different browsers use different mechanisms: WebKit-based browsers use pseudo-elements, while Firefox uses two properties. The CSS Scrollbar Generator produces both forms in one output block, with a live scrollable preview that lets you test the result by scrolling through 24 lines of sample text. Set the width, track colour, thumb colour, and corner radius, and copy the complete block.
What Is the CSS Scrollbar Generator?
The CSS Scrollbar Generator is a visual editor for custom scrollbar styling. It generates two sets of rules for a .scrollable class. The Firefox set uses scrollbar-width set to thin and scrollbar-color with the thumb and track colours. The WebKit set, for Chrome, Edge, and Safari, uses the ::-webkit-scrollbar pseudo-element for width, ::-webkit-scrollbar-track for the track background and radius, and ::-webkit-scrollbar-thumb for the thumb background and radius. Comments in the output label each browser group.
The preview is a scrollable box 180 pixels tall, filled with 24 numbered lines inviting you to scroll, so the scrollbar is always present and testable. The width slider runs from 4 to 24 pixels, with a default of 10. The track colour defaults to a pale tint and the thumb colour to a deep green. The corner radius slider runs from 0 to 12 pixels, with a default of 6, and applies to both the track and the thumb in the WebKit rules.
A hint beneath the preview explains the browser situation honestly: the styled scrollbar shows in Chrome, Edge, and Safari, while Firefox uses the thin and colour fallback included in the CSS. That distinction matters, because Firefox does not support the WebKit pseudo-elements, and its fallback cannot reproduce the exact width or the rounded corners. The generator therefore produces the best available result in each browser, rather than pretending one syntax covers all.
- Width control: a slider from 4 to 24 pixels for the WebKit scrollbar width.
- Track and thumb colours: separate pickers for the track background and the thumb.
- Radius control: a slider from 0 to 12 pixels for the track and thumb corners.
- Dual-browser output: Firefox properties plus WebKit pseudo-element rules in one block.
- Scrollable preview: a box with 24 lines of text, so the scrollbar can be tested by scrolling.
How to Use the CSS Scrollbar Generator
Scroll the preview after every change. A scrollbar is a control you use, not just a shape you look at, and its feel matters as much as its colour.
- Set the scrollbar width. Drag the Scrollbar width slider between 4 and 24 pixels. Narrow widths near 6 to 8 pixels look minimal, while widths near 12 to 16 pixels are easier to grab with a mouse. The default of 10 pixels is a balanced choice.
- Set the corner radius. Drag the Corner radius slider between 0 and 12 pixels. A radius near 6 pixels softens the thumb ends, and a radius of zero gives a sharp rectangular thumb. The radius applies to both the track and the thumb.
- Pick the track colour. Use the Track color picker for the channel the thumb slides in. A pale neutral colour keeps the track unobtrusive, so the thumb stands out as the interactive part.
- Pick the thumb colour. Use the Thumb color picker for the draggable handle. A strong brand colour makes the thumb easy to find, which is the point of styling it. Check that the thumb contrasts clearly with the track.
- Scroll the preview. Drag the scrollbar thumb, use the mouse wheel over the box, or click in the track to move through the 24 lines. Confirm that the thumb is easy to see, easy to grab, and comfortable to use at the chosen width.
- Read the output block. Look at the CSS panel. It contains the Firefox rules first, then the WebKit rules, each labelled with a comment. Notice that the Firefox rules use the same colours but cannot set the width in pixels or the radius.
- Copy the CSS. Click Copy CSS and paste the block into your stylesheet. Apply the scrollable class to the element whose scrollbar you want to style, or rename the class to match your existing selector, including in the pseudo-element rules.
Key Features of the CSS Scrollbar Generator
The tool handles the cross-browser reality of scrollbar styling in one place, so you do not need to remember two syntaxes.
- Complete WebKit rules: width, track, and thumb rules are all generated, with the track and thumb sharing the chosen radius.
- Firefox fallback included: scrollbar-width and scrollbar-color give Firefox users a matching thin scrollbar in the same colours.
- Labelled output: comments separate the Firefox and WebKit sections, making the block easy to understand and edit later.
- Real scrolling preview: the preview contains enough text to require scrolling, so the scrollbar behaves as it will in real use.
- Honest browser hint: the hint beneath the preview states plainly which browsers show the full styling and which use the fallback.
- Single copy action: one button copies the entire block, preventing the common mistake of copying only one browser group.
Practical Use Cases
Custom scrollbars suit contained scrolling areas best, where the scrollbar is part of a component rather than the whole page.
Chat panels and message lists
A chat window with a long message history benefits from a slim, branded scrollbar that does not distract from the conversation. A narrow width and a thumb in the brand colour keep the control present but quiet, and the pale track blends with the panel background.
Sidebars and navigation menus
A sidebar with many links may scroll independently of the main content. A styled scrollbar in the sidebar signals that more links are available below, and a thumb colour that matches the active link colour ties the control to the navigation design.
Code blocks and data tables
Code blocks and wide tables often scroll horizontally or vertically inside a fixed-height container. A visible thumb helps readers judge how much content remains, and a radius that matches the container corners keeps the component feeling unified.
Dashboards and admin panels
Dashboards pack many panels into one screen, and several of them may scroll. Consistent scrollbar styling across panels makes the dashboard feel like one product, rather than a collection of default browser controls in different styles.
Modal dialogs and dropdown lists
A modal with long content, or a dropdown with many options, needs a scrollbar that is easy to find quickly. A slightly wider thumb with strong track contrast helps readers who open the modal for a moment and need to scan its contents fast.
Tips and Best Practices
Scrollbars are controls first and decoration second. Usability must come before novelty.
- Keep the thumb visible: the thumb must contrast clearly with the track at all times. A thumb that blends into the track defeats the purpose of styling it.
- Do not make the scrollbar too narrow: widths below 6 pixels are hard to grab with a mouse and nearly impossible on touch devices that show scrollbars. Favour usability over minimalism.
- Style contained areas, not the whole page, first: custom page-level scrollbars can surprise readers who expect their system scrollbar. Start with panels and sidebars, and test page-level styling carefully.
- Test in Firefox and a WebKit browser: the two renderings differ, because Firefox uses the fallback. Check both, and accept that they will not be identical.
- Respect operating system settings: some users rely on system scrollbar behaviour, including overlay scrollbars and reduced motion. Do not hide scrollbars entirely or make them depend on hover alone.
- Keep the radius modest: a large radius on a narrow thumb can make the thumb look like a pill that is hard to read as a handle. Match the radius to the width.
Limitations
This generator styles the width, track colour, thumb colour, and radius only. It does not support thumb hover or active states, scrollbar buttons, corner styling, horizontal scrollbar height as a separate value, or different styling for different scroll directions. The Firefox fallback is limited to a thin width and two colours, so the exact width and radius you choose will not appear in Firefox.
The output targets a .scrollable class. Styling the scrollbar of the whole page requires applying the rules to the appropriate root selector in your own stylesheet, and the behaviour of page-level scrollbars varies by browser and operating system. The preview shows the styling in your current browser only, so the other browser group cannot be tested from this page alone.
- Width, colours, and radius only; no hover or button states.
- Firefox shows a thin fallback, not the exact width or radius.
- Output targets the .scrollable class; page-level styling needs adaptation.
- Preview reflects your current browser only.
Frequently Asked Questions
Why does my scrollbar look different in Firefox?
Firefox does not support the WebKit scrollbar pseudo-elements. It uses scrollbar-width and scrollbar-color instead, which support only a thin width and two colours. The generator includes those properties as a fallback, so Firefox users see a matching thin scrollbar, but the exact pixel width and rounded corners are WebKit-only.
Can I style the scrollbar of the whole page?
Yes, by applying the rules to the page-level selector in your own stylesheet instead of the .scrollable class. Keep in mind that page-level custom scrollbars affect the entire browsing experience, so test carefully and keep the styling subtle and usable.
What width should I choose?
Ten pixels, the default, is a good balance between visibility and subtlety. Choose 6 to 8 pixels for a minimal look in panels where space is tight, and 12 to 16 pixels where the scrollbar is a primary control, such as a long data list. Avoid widths below 6 pixels for usability.
Why is there no scrollbar in the preview?
Some operating systems hide scrollbars until scrolling begins, showing overlay scrollbars instead. Try scrolling inside the preview box with a mouse wheel or trackpad gesture. If your system uses overlay scrollbars, the styled scrollbar may appear only while scrolling is active.
Can I add a hover colour for the thumb?
Not in this tool, which generates the base thumb rule only. To add a hover state, write a ::-webkit-scrollbar-thumb:hover rule by hand in your stylesheet, using a slightly darker or lighter version of the thumb colour.
Scrollbar Styling and User Expectations
Scrollbars sit in an unusual position: they are part of the browser chrome that users learn once and expect everywhere, yet they appear inside web pages where designers want control. Styling a scrollbar therefore involves a trade-off that most other CSS does not. A custom scrollbar that matches the site palette feels polished, but a scrollbar that behaves unexpectedly, because it is too thin to grab or too faint to see, frustrates users in a way that a mismatched colour never would. The controls in the CSS Scrollbar Generator are deliberately limited to width, colours, and radius, which keeps the styling within the bounds of what users will accept without noticing the mechanism.
Operating systems add another layer of expectation. On some systems, scrollbars are always visible; on others, they appear only while scrolling, as overlays that fade away. A custom width and colour scheme designed on a system with persistent scrollbars may look quite different on a system with overlay scrollbars, where the styled thumb appears briefly over the content. There is no way to control that system behaviour from CSS, and the generator does not pretend otherwise. The honest approach is to style the scrollbar for the systems where it is visible, keep the styling subtle, and accept that some users will see their system default.
Accessibility considerations reinforce the same caution. Users with motor difficulties need a thumb large enough to grab reliably, and users with low vision need strong contrast between thumb and track. A fashionable hairline scrollbar fails both groups. The defaults in this tool, ten pixels wide with a dark thumb on a pale track, are a reasonable compromise between style and usability. If you narrow the width or soften the contrast for aesthetic reasons, test the result with a mouse, a trackpad, and keyboard scrolling, and ask whether the gain in appearance is worth the loss in control.
Related Tools
These tools cover forms, tables, and backgrounds that often contain scrollable areas.
- CSS Form Generator – style forms inside scrollable panels and modals.
- CSS Table Generator – style tables that scroll inside fixed-height containers.
- CSS Background Generator – design panel backgrounds that scrollbars sit on.
- CSS Border Radius Generator – match container corners to scrollbar rounding.
- Color Picker – choose track and thumb colours from your palette.