Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hide tab bar on firefox 57 when there is only one tab
/*
How To:
1. Find your firefox profile folder : https://support.mozilla.org/en-US/kb/profiles-where-firefox-stores-user-data
2. create a "chrome" folder if it doesn't exist
3. Paste content of this gist in a "userChrome.css" file
4. Restart Firefox
Don't hesitate to say if there are bugs, I only tested this for my workflow : I don't use tabs
at all but I want to see the bar if I open a tab by mistake (otherwise I sometimes lose a tab)
*/
#tabbrowser-tabs, #tabbrowser-tabs > .tabbrowser-arrowscrollbox {
min-height: 0 !important;
}
/* Thanks to @Speravir for making it work again in the latest versions. */
#tabbrowser-tabs tab[first-visible-tab="true"][last-visible-tab="true"] {
visibility: collapse;
}
/* I don't use tabs so I just hide the new tab button. You should be able to use a similar trick as the rule above with
css siblings selectors if you want to keep it when the tab bar is visible. */
#tabbrowser-tabs .tabs-newtab-button {
visibility: collapse !important;
}
#tabbrowser-tabs tab {
min-height: var(--tab-min-height)
}
@masterdam79

This comment has been minimized.

Copy link

masterdam79 commented Mar 26, 2018

Brilliant!!

@RU-XerYuS

This comment has been minimized.

Copy link

RU-XerYuS commented Apr 29, 2018

Da Shiz! Worked like a charm. In Ubuntu under Home .mozilla/firefox/random.default folder - created the chome folder and added your script inside and... Awesome! Many thanks for sharing!

@ghost

This comment has been minimized.

Copy link

ghost commented May 11, 2018

Is it just me or did this stop working after updating to Firefox 60?

@akurth

This comment has been minimized.

Copy link

akurth commented May 12, 2018

I can confirm that it's not working with FF 60 any more.

@Pmmlabs

This comment has been minimized.

Copy link

Pmmlabs commented May 13, 2018

For FF 57+

@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

/* to hide the native tabs */
#TabsToolbar {
    visibility: collapse;
}

/* to hide the sidebar header */
#sidebar-header {
    visibility: collapse;
}
@akurth

This comment has been minimized.

Copy link

akurth commented May 14, 2018

This solution hides the tab bar unconditionally. If you look at the original CSS, you'll notice the condition [first-tab="true"][last-tab="true"], which hides the tab bar if there is only one tab left (first and last tab at the same time).

For any reason these properties aren't honoured any more, though still documented.

@Speravir

This comment has been minimized.

Copy link

Speravir commented May 14, 2018

@BenoitAverty, @akurth, @teppot, @Pmmlabs. After someone complained about this in German Camp-Firefox forum I took a quick look on this and suggested the change you can see below. Though I didn’t check on my own apparently this seems to work because the user was happy with it.

In line 15 above add twice a visible- (do not forget the hyphen sign) so that it looks as follows

#tabbrowser-tabs tab[first-visible-tab="true"][last-visible-tab="true"] {
	visibility: collapse;
}
@KHKH

This comment has been minimized.

Copy link

KHKH commented May 14, 2018

FANTASTIC! Thanks a lot, Speravir!! 👍

@thekswenson

This comment has been minimized.

Copy link

thekswenson commented May 22, 2018

This doesn't work with FF60 :(.

@vladikavladika

This comment has been minimized.

Copy link

vladikavladika commented May 22, 2018

@Speravir, that's not what I suppose "Hide tab bar" should do [c.f. the no more supported "hide one tab" add-on]. The problem is the PLUS SIGN [=open a new tab] that has not disappeared, which causes a grey horizontal bar [containing just the PLUS SIGN] under the title bar. Any workarround?

@KHKH

This comment has been minimized.

Copy link

KHKH commented May 22, 2018

@vladikavladika and @thekswenson:
It DOES work with FF 60 and the PLUS sign is gone with Speravirs solution. If it doesn't work with you, you must have gotten something wrong with the code. See my screenshot - no plus.
screenshot

@KHKH

This comment has been minimized.

Copy link

KHKH commented May 22, 2018

Once again here's the complete code you have to copy&paste into userChrome.css, including Speravirs addition to the original code:

/*
How To:

  1. Find your firefox profile folder : https://support.mozilla.org/en-US/kb/profiles-where-firefox-stores-user-data
  2. create a "chrome" folder if it doesn't exist
  3. Paste content of this gist in a "userChrome.css" file
  4. Restart Firefox

Don't hesitate to say if there are bugs, I only tested this for my workflow : I don't use tabs
at all but I want to see the bar if I open a tab by mistake (otherwise I sometimes lose a tab)
*/
#tabbrowser-tabs, #tabbrowser-tabs > .tabbrowser-arrowscrollbox {
min-height: 0 !important;
}

#tabbrowser-tabs tab[first-visible-tab="true"][last-visible-tab="true"] {
visibility: collapse;
}

/* I don't use tabs so I just hide the new tab button. You should be able to use a similar trick as the rule above with
css siblings selectors if you want to keep it when the tab bar is visible. */
#tabbrowser-tabs .tabs-newtab-button {
visibility: collapse !important;
}

#tabbrowser-tabs tab {
min-height: var(--tab-min-height)
}

@vladikavladika

This comment has been minimized.

Copy link

vladikavladika commented May 23, 2018

@KHKH, @Speravirs, "mea culpa"! :-( Accidentally, I edited a completely different line. But now it works :-) Thanks.

@KHKH

This comment has been minimized.

Copy link

KHKH commented May 23, 2018

Great. You're welcome! :-)

@BenoitAverty

This comment has been minimized.

Copy link
Owner

BenoitAverty commented May 28, 2018

Thanks! I came back here myself because it didn't work anymore and I wasn't expecting so much activity! I updated the gist to make it work again for the latest version.

@AdamPS

This comment has been minimized.

Copy link

AdamPS commented Aug 2, 2018

It's nice, but when the tabs are hidden I have no visible sign that a page is loading. When there are tabs, progress is shown by the dot on the tab icon that swings left/right. Does anyone have any idea how to get back some sort of progress marker without the tab bar? In the old days we had the spinning wheel:-)

@daev3000

This comment has been minimized.

Copy link

daev3000 commented Aug 9, 2018

It works perfectly on Firefox 61. Thank you!

@rrthomas

This comment has been minimized.

Copy link

rrthomas commented Aug 22, 2018

This is fantastic, I've been looking for something to do this ever since Hide One Tab stopped being supported!

@Cirminello

This comment has been minimized.

Copy link

Cirminello commented Sep 12, 2018

How to make the plus button visible when there are two or more tabs opened?
Thanks

@daver1691

This comment has been minimized.

Copy link

daver1691 commented Sep 17, 2018

BenoitAverty wrote:

You should be able to use a similar trick as the rule above with css siblings selectors if you want to keep [the new tab button] when the tab bar is visible.

This is the first time I've written any CSS, so I'm Googling for syntax, and I've not got this working. I think that the following was intended by the above comment:

.tabbrowser-tab[first-visible-tab="true"][last-visible-tab="true"] ~ .tabs-newtab-button{
    visibility: collapse !important;
}

I've looked at the tab bars with the "Browser Toolbox" inspector, and the .tabbrowser-tab and .tabs-newtab-button elements seem to be on the same level, and therefore should be CSS siblings, but something isn't working. I find that the sibling selector works within the line of tabs, and I've experimentally changed the background colour of the second and subsequent tabs, but I can't select the new tab button with a sibling selector for some reason. The only thing I can point to is a comment that is visible in the inspector before the tabs which says:

This is a hack to circumvent bug 472020, otherwise the tabs show up on the right of the newtab button.

... and then after the tabs but before the new tab button is the comment:

This is to ensure anything extensions put here will go before the newtab button, necessary due to the previous hack.

I think that this comment indicates there's something that's not visible in the inspector that's disabling the sibling selector, but as I said, I'm totally new to this, so I could be misreading it.

Anybody else know what's going on?

@TomaszGasior

This comment has been minimized.

Copy link

TomaszGasior commented Dec 26, 2018

I created my own userChrome.css based on your work. It works properly in private browsing and in other special cases. Please read comments.

/**
 * Firefox by default specifies the height for tabs container (tabs bar).
 * This code unsets height from tabs container and sets it separately to each tab.
 */
#tabbrowser-tabs, #tabbrowser-tabs > .tabbrowser-arrowscrollbox {
	min-height: 0 !important;
}
tab.tabbrowser-tab {
	min-height: var(--tab-min-height) !important;
}

/**
 * Following code is hiding only one opened tab from tabs container (tabs bar).
 *
 * Only one opened tab is hidden only when these conditions are met.
 *  * Private browsing mode is NOT used (Fx needs to show "private" indicator).
 *  * Accessibility service is NOT enabled (Fx needs to show "a11y" indicator).
 *  * Fullscreen view is NOT entered (Fx needs to show minimize/restore/close buttons).
 *  * Fx's customize page is NOT shown (otherwise it's hard to customize tabs bar).
 *  * Regular system title bar is used instead client-side (otherwise UI is broken).
 */
window:not([inFullscreen="true"]):not([tabsintitlebar="true"]):not([accessibilitymode="true"]):not([privatebrowsingmode]):not([customize-entered="true"])
tab.tabbrowser-tab[first-visible-tab="true"][last-visible-tab="true"] {
	display: none !important;
}

/**
 * Following code makes sure that one opened tab is re-shown when tabs toolbar
 * contains additional items (such as new tab button).
 *
 * This code can be buggy. Feel free to remove it if the whole stylesheet doesn't work.
 * But in this case, remember to remove all items from tabs toolbar using customizer!
 * The first selector is for Firefox 64, second is for Firefox 65.
 */
toolbar#TabsToolbar[currentset]:not([currentset="tabbrowser-tabs,alltabs-button"])
tabs#tabbrowser-tabs tab.tabbrowser-tab[first-visible-tab="true"][last-visible-tab="true"]
{
	display: -moz-box !important;
}
#TabsToolbar-customization-target tabs#tabbrowser-tabs:not(:nth-child(2))
tab.tabbrowser-tab[first-visible-tab="true"][last-visible-tab="true"],
#TabsToolbar-customization-target tabs#tabbrowser-tabs:not(:nth-last-child(3))
tab.tabbrowser-tab[first-visible-tab="true"][last-visible-tab="true"]
{
	display: -moz-box !important;
}

Also, I wrote post on my blog about this modification: https://tomaszgasior.pl/oprogramowanie/mozilla-firefox-ukrywanie-paska-kart-przy-jednej-otwartej-karcie (Polish but google translate is your friend).

@Seirade

This comment has been minimized.

Copy link

Seirade commented Dec 31, 2018

@daver1691, the new tab button doesn't feature the first/last-visible-tab attributes. However, I got it to work with:

.tabs-newtab-button
{
    height: 0px;
}
@compwrench

This comment has been minimized.

Copy link

compwrench commented Jan 17, 2019

Also, I wrote post on my blog about this modification: https://tomaszgasior.pl/oprogramowanie/mozilla-firefox-ukrywanie-paska-kart-przy-jednej-otwartej-karcie (Polish but google translate is your friend).

Thank you so very much. Reading your comments, I kept saying yes, yes, yes. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment