Firefox can be customized far beyond what the Settings page exposes. userChrome.css lets you modify the browser's own UI — tabs, toolbar, sidebar, menus — with custom CSS.
Enabling userChrome.css
Firefox doesn't load userChrome.css by default. You need to enable it:
- Go to
about:config - Search for
toolkit.legacyUserProfileCustomizations.stylesheets - Set it to
true
Now Firefox will load CSS from your profile's chrome/ folder.
Finding Your Profile Folder
- Go to
about:support - Look for "Profile Directory" → click "Open Directory"
- Inside, create a folder called
chrome - Inside
chrome, create a file calleduserChrome.css
Structure
/* userChrome.css */
/* Target the browser UI elements here */
#TabsToolbar { ... }
#sidebar-box { ... }
toolbarbutton { ... }
Changes take effect after restarting Firefox.
Useful Recipes
Hide the Tab Bar (when using vertical tabs or Tree Style Tab)
If you use the vertical tab sidebar (Firefox 131+) or an extension like Tree Style Tab, you can hide the horizontal tab bar:
#TabsToolbar {
visibility: collapse !important;
}
Compact Mode (smaller toolbar and tabs)
Firefox removed compact density mode from the UI in version 89, but you can restore it:
:root:-moz-lwtheme {
--tab-min-height: 26px !important;
}
#nav-bar {
--toolbarbutton-outer-padding: 1px !important;
}
#urlbar {
--urlbar-height: 28px !important;
--urlbar-toolbar-height: 32px !important;
}
Change Tab Font Size
.tab-label {
font-size: 12px !important;
}
Move the Tab Bar Below the Navigation Bar
#navigator-toolbox {
flex-direction: column;
}
#TabsToolbar {
order: 2;
}
#nav-bar {
order: 1;
}
Hide the Close Button on Inactive Tabs
.tabbrowser-tab:not([selected]) .tab-close-button {
display: none !important;
}
Colorize Pinned Tabs
.tabbrowser-tab[pinned] .tab-background {
background-color: rgba(0, 128, 255, 0.2) !important;
}
Auto-Hide the Sidebar
#sidebar-box {
min-width: 0px !important;
width: 18px !important;
overflow: hidden !important;
transition: width 0.3s ease !important;
}
#sidebar-box:hover {
width: 250px !important;
}
userContent.css
Similar to userChrome.css, userContent.css in the same chrome/ folder lets you add CSS to web pages globally.
Example — add a dark background to all pages that use system color schemes:
@media (prefers-color-scheme: dark) {
:root {
background-color: #1a1a1a;
color: #e0e0e0;
}
}
Note: this applies to ALL pages. Be careful with blanket rules.
Where to Find More Recipes
-
FirefoxCSS Subreddit (
r/FirefoxCSS) — Active community sharing userChrome snippets -
FirefoxCSS Store (
firefoxcss.github.io) — Gallery of complete userChrome themes - Mozilla Wiki: UserChrome — Official documentation for available CSS selectors
Updating After Firefox Updates
Firefox's internal UI can change between major versions, which means userChrome.css rules can break. When Firefox updates and your customizations stop working:
- Open the Browser Toolbox (
about:debugging→ This Firefox → Browser Toolbox, orCtrl+Shift+Alt+I) - Use the inspector to find the updated element selectors
- Update your CSS
Firefox's major UI changes happen roughly every few versions — usually just minor selector changes.
For Sessions: Complement, Not Replace
userChrome.css modifies the visual UI — it won't help you manage actual tab content or session state. For saving and restoring named tab sessions (especially useful if you're experimenting with a heavily customized UI and want to restore specific work contexts), Tab Manager & Session Saver handles that at the extension level.
userChrome.css is one of the most underused Firefox features. The combination of compact mode, hidden tab bar for vertical tabs, and an auto-hiding sidebar gives you a significantly more productive workspace without any external tooling.
Top comments (0)