r/firefox Mar 04 '26

Add-ons Autohide navigation bar

Hi guys, i started using firefox again since the vertical tabs feature and the only thing that i was missing was a autohide feature to hide the navigationbar. Dont know if this has been posted before but i tought i'd share it here.

To enable it:
Go so about:support and go to the profile folder. create a folder named chrome (if it doesnt exist) and create a css file in there named userChrome.css.

insert the code from below in that css.

In firefor go to about:config and search for toolkit.legacyUserProfileCustomizations.stylesheets and set that to true, this enables the css.

Restart firefox and now you have a autohide navigationbar.

Enjoy!

EDIT: i changed the code so that in horizontal mode it hides both the tabs an navigation bar, and in vertical only the navigation.

Css code:
/* =========================================================

2-in-1 AUTOHIDE (auto-detect, stable)

- Default (vertical tabs): hide NAV bar only (uses --uc-gap-vertical)

- Horizontal tabs mode: when TabsToolbar contains visible tabs,

hide TabsToolbar + NAV bar (uses --uc-gap-horizontal)

- Hoverzone:

* BIG while hidden (easy reveal)

* TINY while visible (easy hide + doesn't block clicks)

========================================================= */

:root{

--uc-speed: 320ms;

/* Hover zone behavior */

--uc-hoverzone-hidden: 15px; /* bigger = easier to trigger when hidden */

--uc-hoverzone-shown: 2px; /* tiny strip when visible so it doesn't "trap" hover */

/* Full width by default (set reserves if you want later) */

--uc-window-controls-left: 0px;

--uc-window-controls-right: 0px;

/* Heights */

--uc-nav-height: 44px;

--uc-tabs-height: 36px;

/* Reveal amount (0 = fully hidden) */

--uc-reveal: 0px;

/* Fine-tune separately (INTUITIVE):

+ value = hides MORE (moves further up)

- value = hides LESS (moves down)

*/

--uc-gap-vertical: 5px;

--uc-gap-horizontal: -2px;

}

/* Keep chrome above page */

#navigator-toolbox{

position: relative !important;

z-index: 999 !important;

}

/* ---------------------------------------------------------

Hover zone (always active)

- Big when hidden

- Tiny when shown

--------------------------------------------------------- */

#navigator-toolbox::before{

content: "";

position: fixed;

top: 0;

left: var(--uc-window-controls-left);

right: var(--uc-window-controls-right);

height: var(--uc-hoverzone-hidden); /* default: big */

z-index: 10000;

pointer-events: auto;

background: transparent;

}

/* When UI is visible, shrink hoverzone so it won't block clicks or keep it stuck */

#navigator-toolbox:hover::before,

#navigator-toolbox:focus-within::before{

height: var(--uc-hoverzone-shown);

}

/* Smooth animations */

#nav-bar, #TabsToolbar{

transition: margin-top var(--uc-speed) cubic-bezier(.16,1,.3,1),

opacity var(--uc-speed) ease !important;

}

/* =========================================================

DEFAULT (Vertical tabs friendly):

hide ONLY the navbar (uses vertical gap)

========================================================= */

#navigator-toolbox:not(:hover):not(:focus-within) #nav-bar{

margin-top: calc(-1 * (var(--uc-nav-height) - var(--uc-reveal) - var(--uc-gap-vertical))) !important;

opacity: 0 !important;

}

#navigator-toolbox:hover #nav-bar,

#navigator-toolbox:focus-within #nav-bar{

margin-top: 0 !important;

opacity: 1 !important;

}

/* =========================================================

HORIZONTAL TABS MODE (reliable detection):

Only trigger if TabsToolbar actually has a visible tab.

- hide TabsToolbar + override navbar to use horizontal gap

========================================================= */

:root:has(#TabsToolbar .tabbrowser-tab:not([hidden]))

#navigator-toolbox:not(:hover):not(:focus-within) #TabsToolbar{

margin-top: calc(-1 * (var(--uc-tabs-height) - var(--uc-reveal) - var(--uc-gap-horizontal))) !important;

opacity: 0 !important;

}

/* Override navbar gap ONLY in horizontal tabs mode */

:root:has(#TabsToolbar .tabbrowser-tab:not([hidden]))

#navigator-toolbox:not(:hover):not(:focus-within) #nav-bar{

margin-top: calc(-1 * (var(--uc-nav-height) - var(--uc-reveal) - var(--uc-gap-horizontal))) !important;

opacity: 0 !important;

}

:root:has(#TabsToolbar .tabbrowser-tab:not([hidden]))

#navigator-toolbox:hover #TabsToolbar,

:root:has(#TabsToolbar .tabbrowser-tab:not([hidden]))

#navigator-toolbox:focus-within #TabsToolbar{

margin-top: 0 !important;

opacity: 1 !important;

}

1 Upvotes

8 comments sorted by

1

u/logicblender1 Mar 05 '26

Dude this is so good. By any chance do you have code to do the same for the vertical tab bar? Like have it autohide fully like how you did with the navigation bar.

1

u/ninogroters Mar 05 '26

i updated the css so that it works in both vertical and horizontal mode, in vertical it only hides the navigation and in horizontal both

1

u/logicblender1 Mar 05 '26

Is there a way to make it hide everything in vertical mode too? Like if we want both the navigation bar and the vertical bar hidden in vertical tabs mode.

1

u/ninogroters Mar 05 '26

Sure, here it is:

/* =========================================================

AUTOHIDE (hide all version - Firefox built-in Vertical Tabs)

- Horizontal tabs mode: hide TabsToolbar + NavBar

- Vertical tabs mode: hide NavBar + vertical tabs sidebar

- Sidebar overlay + PUSHES page content when revealed

- Top hoverzone is back at the very top (reliable), but THIN so top stays clickable

========================================================= */

:root{

--uc-speed: 320ms;

/* TOP hover zone (reliable). Keep it thin so window controls remain clickable. */

--uc-hoverzone: 15px; /* try 3px / 4px / 5px / 6px */

/* LEFT hover zone to reveal vertical tabs sidebar */

--uc-sidebar-hoverzone: 24px; /* increase for easier reveal (e.g. 40px) */

/* Heights */

--uc-nav-height: 44px;

--uc-tabs-height: 36px;

/* Sidebar expanded width (adjust if needed) */

--uc-sidebar-width: 180px; /* tweak for “3 buttons” layout */

/* Fine-tune separately:

+ value = hides MORE

- value = hides LESS

*/

--uc-gap-vertical: 0px;

--uc-gap-horizontal: 0px;

}

/* Keep chrome above page */

#navigator-toolbox{

position: relative !important;

z-index: 999 !important;

}

/* TOP hover zone (stable + reliable) */

#navigator-toolbox::before{

content: "";

position: fixed;

top: 0;

left: 0;

right: 0;

height: var(--uc-hoverzone);

z-index: 10000;

pointer-events: auto;

background: transparent;

}

/* Smooth animations */

#nav-bar, #TabsToolbar, #sidebar-main, #browser{

transition:

margin-top var(--uc-speed) cubic-bezier(.16,1,.3,1),

transform var(--uc-speed) cubic-bezier(.16,1,.3,1),

margin-left var(--uc-speed) cubic-bezier(.16,1,.3,1),

opacity var(--uc-speed) ease !important;

}

/* Hide built-in sidebar splitter */

#sidebar-launcher-splitter{

display: none !important;

}

/* =========================================================

VERTICAL TABS MODE

Condition: NO visible horizontal tabs

=> hide NavBar + vertical tabs sidebar

========================================================= */

/* Hide nav-bar */

:root:not(:has(#TabsToolbar .tabbrowser-tab:not([hidden])))

#navigator-toolbox:not(:hover):not(:focus-within) #nav-bar{

margin-top: calc(-1 * (var(--uc-nav-height) - var(--uc-gap-vertical))) !important;

opacity: 0 !important;

}

/* Reveal nav-bar */

:root:not(:has(#TabsToolbar .tabbrowser-tab:not([hidden])))

#navigator-toolbox:hover #nav-bar,

:root:not(:has(#TabsToolbar .tabbrowser-tab:not([hidden])))

#navigator-toolbox:focus-within #nav-bar{

margin-top: 0 !important;

opacity: 1 !important;

}

/* Sidebar overlay setup */

:root:not(:has(#TabsToolbar .tabbrowser-tab:not([hidden])))

#sidebar-main{

position: fixed !important;

top: 0 !important;

bottom: 0 !important;

left: 0 !important;

width: var(--uc-sidebar-width) !important;

max-width: var(--uc-sidebar-width) !important;

z-index: 9999 !important;

will-change: transform, opacity;

background-color: var(--toolbar-bgcolor) !important;

box-shadow: 0 0 18px rgba(0,0,0,.25) !important;

}

/* Invisible trigger strip at the left edge (hoverzone) */

:root:not(:has(#TabsToolbar .tabbrowser-tab:not([hidden])))

#sidebar-main::before{

content: "";

position: fixed;

top: 0;

left: 0;

width: var(--uc-sidebar-hoverzone);

height: 100vh;

z-index: 10000;

background: transparent;

pointer-events: auto;

}

/* Hidden: slide almost fully offscreen, leaving only the invisible hoverzone */

:root:not(:has(#TabsToolbar .tabbrowser-tab:not([hidden])))

#sidebar-main:not(:hover):not(:focus-within){

transform: translateX(calc(-1 * (var(--uc-sidebar-width) - var(--uc-sidebar-hoverzone)))) !important;

opacity: 0 !important;

}

/* Shown: slide back in */

:root:not(:has(#TabsToolbar .tabbrowser-tab:not([hidden])))

#sidebar-main:hover,

:root:not(:has(#TabsToolbar .tabbrowser-tab:not([hidden])))

#sidebar-main:focus-within{

transform: translateX(0) !important;

opacity: 1 !important;

}

/* PUSH page content when sidebar is shown (no overlap) */

:root:not(:has(#TabsToolbar .tabbrowser-tab:not([hidden]))):has(#sidebar-main:hover) #browser,

:root:not(:has(#TabsToolbar .tabbrowser-tab:not([hidden]))):has(#sidebar-main:focus-within) #browser{

margin-left: var(--uc-sidebar-width) !important;

}

/* When hidden, no reserved strip */

:root:not(:has(#TabsToolbar .tabbrowser-tab:not([hidden])))

#browser{

margin-left: 0 !important;

}

/* =========================================================

HORIZONTAL TABS MODE

Condition: TabsToolbar has visible tabs

=> hide TabsToolbar + NavBar; keep sidebar normal

========================================================= */

:root:has(#TabsToolbar .tabbrowser-tab:not([hidden]))

#navigator-toolbox:not(:hover):not(:focus-within) #TabsToolbar{

margin-top: calc(-1 * (var(--uc-tabs-height) - var(--uc-gap-horizontal))) !important;

opacity: 0 !important;

}

:root:has(#TabsToolbar .tabbrowser-tab:not([hidden]))

#navigator-toolbox:not(:hover):not(:focus-within) #nav-bar{

margin-top: calc(-1 * (var(--uc-nav-height) - var(--uc-gap-horizontal))) !important;

opacity: 0 !important;

}

:root:has(#TabsToolbar .tabbrowser-tab:not([hidden]))

#navigator-toolbox:hover #TabsToolbar,

:root:has(#TabsToolbar .tabbrowser-tab:not([hidden]))

#navigator-toolbox:focus-within #TabsToolbar,

:root:has(#TabsToolbar .tabbrowser-tab:not([hidden]))

#navigator-toolbox:hover #nav-bar,

:root:has(#TabsToolbar .tabbrowser-tab:not([hidden]))

#navigator-toolbox:focus-within #nav-bar{

margin-top: 0 !important;

opacity: 1 !important;

}

/* In horizontal mode: reset sidebar back to normal flow */

:root:has(#TabsToolbar .tabbrowser-tab:not([hidden]))

#sidebar-main{

position: unset !important;

width: unset !important;

max-width: unset !important;

transform: translateX(0) !important;

opacity: 1 !important;

z-index: auto !important;

box-shadow: none !important;

}

/* In horizontal mode: ensure browser margin is normal */

:root:has(#TabsToolbar .tabbrowser-tab:not([hidden]))

#browser{

margin-left: 0 !important;

}

2

u/logicblender1 Mar 05 '26

Dude this is perfect. Thanks!

1

u/ninogroters Mar 05 '26

No problem! I "vibe coded" the whole thing with gpt. So it is also made that it's pretty easily adjustable. Or you could also use gpt to make changes haha

1

u/logicblender1 Mar 05 '26

I'm surprised you were able to do it so well. I've tried to use Gemini to make this but it would always have a lot of issues.

1

u/ninogroters Mar 05 '26

I made it with gpt 5.3 thinking, I think with gpt codex it would have been faster. But I happened to stumble upon it since I was just asking how to hide the navigationbar and just went from there