Customize Firefox Scrollbar with CSS – Simple Guide
In this article
Yes, you can customize Firefox’s scrollbar by editing the userChrome.css file or by using built‑in CSS variables, and the changes apply to every page you visit.
What You’ll Need
- Firefox (latest stable release recommended)
- A text editor such as Notepad, VS Code, or any plain‑text editor
- Access to your Firefox profile folder
Step‑by‑Step
- Open Firefox and type
about:configin the address bar. Press Enter. - Accept the warning if it appears, then search for
toolkit.legacyUserProfileCustomizations.stylesheets. - Set that preference to
trueby double‑clicking it. This tells Firefox to loaduserChrome.cssfiles. - Open the profile folder: type
about:supportin the address bar, press Enter, and click the “Open Folder” button next to “Profile Folder”. - Inside the profile folder, create a new folder named
chromeif it does not already exist. - Within the
chromefolder, create a file calleduserChrome.css. Use your text editor to open it. - Paste the following CSS into
userChrome.css(you can adjust the colors, width, and radius to suit your taste):/* Simple scrollbar styling */ scrollbar { width: 12px !important; height: 12px !important; } scrollbar-thumb { background-color: #6b8e23 !important; /* olive‑drab */ border-radius: 6px !important; border: 2px solid #fff !important; } scrollbar-track { background: #f0f0f0 !important; border-radius: 6px !important; } - Save the file and close the editor.
- Restart Firefox completely (close all windows, then start again). The new scrollbar style should now be visible on any web page that uses the native scrollbar.
Common Mistakes
- Skipping the
toolkit.legacyUserProfileCustomizations.stylesheetstoggle – without it Firefox ignoresuserChrome.css. - Saving the file with a
.txtextension instead of.css. Ensure the file name is exactlyuserChrome.css. - Placing the file in the wrong directory. It must be inside the
chromesub‑folder of the active profile. - Using CSS syntax errors (missing braces, semicolons, or the
!importantflag). A single syntax error prevents the whole file from loading.
Tips
- Use
about:profilesto see a list of all profiles if you manage multiple Firefox installations. - Experiment with
scrollbar-widthandscrollbar-colorCSS properties for a simpler approach that works withoutuserChrome.css, but note they only affect scrollbars on pages that respect those properties. - Keep a backup copy of your
userChrome.cssbefore making major changes; you can restore it quickly if something breaks. - If you want different styles for dark mode, add a media query:
@media (prefers-color-scheme: dark) { scrollbar-thumb { background-color: #b0c4de !important; } }
Troubleshooting
- Scrollbars did not change after restart. Verify that the
toolkit.legacyUserProfileCustomizations.stylesheetspreference is still set totrue. A Firefox update can reset it. - The CSS seems to be ignored on some sites. Some websites use custom scrollbars built with JavaScript or CSS that override the native scrollbar. In those cases, Firefox’s native styling cannot replace the site’s design.
- Firefox shows a blank page or error after adding CSS. Open
about:configand search fordevtools.console.stdout.content. Set it totrue, then open the Browser Console (Ctrl+Shift+J) to view any CSS parsing errors. - Changes disappear after a Firefox update. Re‑check the
toolkit.legacyUserProfileCustomizations.stylesheetstoggle and ensure theuserChrome.cssfile was not overwritten during the update. - If none of the above works, move the
userChrome.cssfile temporarily to the desktop, delete thechromefolder, create a fresh one, and paste the file back. This clears any hidden corruption.
Frequently Asked Questions
Can I change the scrollbar width without editing CSS?
Firefox supports the scrollbar-width property on web pages, but it only offers three preset sizes (auto, thin, none). For full control you need userChrome.css or a user style extension.
Do these changes affect scrollbars inside iframes?
Yes, native scrollbars inside iframes inherit the same userChrome.css rules, unless the iframe content applies its own custom scrollbar styling.
Will my custom scrollbar work on Linux, macOS, and Windows?
The CSS targets Firefox’s internal UI, so it works the same across all desktop operating systems that run Firefox.
Is there a way to revert to the default scrollbar quickly?
Simply rename or delete userChrome.css and restart Firefox. The browser will fall back to the built‑in default style.
Can I use an extension instead of userChrome.css?
Yes, extensions such as “Stylus” let you inject CSS into pages, but they cannot modify the browser chrome (the UI around the page). For scrollbar UI changes, userChrome.css is the only reliable method.
Will customizing the scrollbar affect performance?
Changing only the visual style has negligible impact on performance. However, extremely complex CSS or large images used as scrollbar tracks could cause minor rendering slow‑downs.