Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 27 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save henrik242/3abf4c52ebf81add5cfe38acf97c2053 to your computer and use it in GitHub Desktop.
Save henrik242/3abf4c52ebf81add5cfe38acf97c2053 to your computer and use it in GitHub Desktop.
Tab close button on the left in Firefox Quantum
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
.tabbrowser-tab .tab-throbber,
.tabbrowser-tab .tab-icon-image,
.tabbrowser-tab .tab-sharing-icon-overlay,
.tabbrowser-tab .tab-icon-overlay,
.tabbrowser-tab .tab-label-container,
.tabbrowser-tab .tab-icon-sound {
-moz-box-ordinal-group: 2 !important;
}
.tabbrowser-tab .tab-label-container {
margin-left: 2px;
}
.tabbrowser-tab .tab-icon-image {
margin-left: 3px;
}
.tabbrowser-tab .tab-close-button {
margin-left: -5px !important;
margin-right: 2.5px !important;
}
.tabbrowser-tab:not([pinned="true"]):hover .tab-close-button {
display: -moz-box !important;
}
.tabbrowser-tab:not([pinned="true"]):hover .tab-icon-stack,
.tabbrowser-tab:not([pinned="true"]):hover .tab-throbber,
.tab-close-button {
display: none;
}
@Dr-Octopus-dev
Copy link

Whenever I point to the tab, the text inside moves,how to change this?

@frommie
Copy link

frommie commented Jan 23, 2022

Following works using Firefox 96.0.2:

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

.tabbrowser-tab .tab-throbber,
.tabbrowser-tab .tab-icon-image,
.tabbrowser-tab .tab-sharing-icon-overlay,
.tabbrowser-tab .tab-icon-overlay,
.tabbrowser-tab .tab-label-container,
.tabbrowser-tab .tab-icon-sound {
  -moz-box-ordinal-group: 2 !important;
}
.tabbrowser-tab .tab-label-container {
  margin-left: 2px;
}
.tabbrowser-tab .tab-icon-image {
  margin-left: 3px;
}
.tabbrowser-tab .tab-close-button {
  margin-left: -2px !important;
  margin-right: 2.5px !important;
}
.tabbrowser-tab:not([pinned="true"]):hover .tab-close-button {
  display: -moz-box !important;
}
.tabbrowser-tab:not([pinned="true"]):hover .tab-icon-image,
.tabbrowser-tab:not([pinned="true"]):hover .tab-throbber,
.tab-close-button {
  display: none;
}

@Dr-Octopus-dev
Copy link

Hello! This seems not working on Firefox 98? What's the reason?

@henrik242
Copy link
Author

Hello! This seems not working on Firefox 98? What's the reason?

Have you tried the latest version in this Gist? I just updated it for v98. It works for me, at least.

@Dr-Octopus-dev
Copy link

Yeah, I've tried. It solve my problem. Thank you!
But I still don't know what happened before.

@henrik242
Copy link
Author

henrik242 commented Mar 15, 2022

But I still don't know what happened before.

The CSS for the layout in Firefox has changed slightly and this recipe had to adapt to that.

@maclunar
Copy link

For Linux 🐧 users - you can find the profile directory by following this mozilla's guide (usually ~/.mozilla/firefox/PROFILE_ID/)
cd there and then just mkdir chrome && touch chrome/userChrome.css to create the userChrome file.

@aluto-ss
Copy link

Thanks

@int-369
Copy link

int-369 commented Apr 26, 2023

After completing steps in description my tabs close buttons gone. Anyone know how to solve it? (version 113.0b8 (64-bit))
Thanks in advance!

@fossilet
Copy link

fossilet commented May 10, 2023

It is supposed to replace the favicon at the left end of the tabbar with the close button when hovering, but today I upgraded firefox to 113, when I hover, the favicon disappears, the tabbar shrinks, but the close button is not revealed. How to fix this?

@valrus
Copy link

valrus commented Oct 13, 2023

@int-369 @fossilet Here's a fixed version (for me) that replaces favicons with close buttons on hover on Firefox >113:

.tabbrowser-tab .tab-throbber,
.tabbrowser-tab .tab-icon-image,
.tabbrowser-tab .tab-sharing-icon-overlay,
.tabbrowser-tab .tab-icon-overlay,
.tabbrowser-tab .tab-label-container,
.tabbrowser-tab .tab-icon-sound {
  order: 2 !important;
}

.tabbrowser-tab .tab-label-container {
  margin-left: 2px;
}

.tabbrowser-tab .tab-icon-image {
  margin-left: 3px;
}

.tabbrowser-tab .tab-close-button {
  margin-left: -5px !important;
  margin-right: 2.5px !important;
}

.tabbrowser-tab:not([pinned]):hover .tab-close-button {
  /* display: -moz-box !important; */
  display: inline-flex !important;
}

.tabbrowser-tab:not([pinned]):hover .tab-icon-stack,
.tabbrowser-tab:not([pinned]):hover .tab-throbber,
.tab-close-button {
  display: none;
}

This explanation in a Reddit thread helped me figure out what to change (tl;dr -moz-box-ordinal-group and -moz-box have been replaced with standard flexbox css)

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