r/FirefoxCSS • • 9h ago

Help Only show close button on tabs when hovering with the mouse

Before one of the recent updates I had:

.tabbrowser-tab:not([pinned]) .tab-close-button {display: none !important;}
.tabbrowser-tab:not([pinned]):hover .tab-close-button {display: flex !important;}

Now it doesn't seem to work. Now the close button will only show if I click on the tab for like a split second.

Thanks.

1 Upvotes

11 comments sorted by

2

u/sifferedd FF/TB/Win11/SUMO contributor 8h ago

Your code works for me on a new FF v161.0 profile. Try it alone.

→ More replies (1)

2

u/jas71 5h ago

.tabbrowser-tab:not([pinned]):not(:hover) .tab-close-button { display: none !important; }

this is what i use

1

u/bobo779256 5h ago

Second line add inline- before flex, work in my css

display: inline-flex !important

1

u/Jay33721 4h ago

I have this in my CSS:

.tabbrowser-tab .tab-close-button {
  visibility: hidden !important;
}

.tabbrowser-tab:hover .tab-close-button {
  visibility: visible !important;
}

1

u/t31os 3h ago

There's one minor issue with this approach, the close button will still be counted as a flex item, so you'll end up with a shorter visible tab label (where/when applicable).

1

u/Jay33721 3h ago

Oh yeah you're right. I hadn't noticed, but now I won't be able to unsee it. So I came up with this instead:

.tabbrowser-tab .tab-close-button {
  display: none !important;
}

.tabbrowser-tab:hover .tab-close-button {
  display: revert !important;
}

1

u/t31os 3h ago

Or use the CSS jas71 posted to make it even shorter (and ignore pinned tabs). ;)

1

u/Jay33721 3h ago

Oh hey yeah that works great.

1

u/SnillyWead 3h ago

I have this:

/* 4. Smart Close Button Logic (Show only on active tab or hover) */

.tabbrowser-tab:not([selected]):not([pinned]) .tab-close-button {

visibility: hidden !important;

}

.tabbrowser-tab:not([selected]):not([pinned]):hover .tab-close-button {

visibility: visible !important;

display: inline-flex !important;

}

.tabbrowser-tab[selected]:not([pinned]) .tab-close-button {

visibility: visible !important;

display: inline-flex !important;

}

1

u/ResurgamS13 2h ago

Also try MrOtherGuy's userstyle 'tab_close_button_always_on_hover.css'.