Matthias Schoettle

PhD Student & Software Developer

Firefox close tab button on hover

There are probably extensions that allow to do that, however, this is not necessary as I will show in this post. Maybe you’ve seen the functionality in Safari or just wondered why the close button for tabs in Firefox can’t just always be there. In Safari, the close button appears when hovering over the tab itself.

The following modification adds this functionality to Firefox. You need to create a file called userChrome.css with the following content:

.tabbrowser-tab:not([selected]) .tab-close-button {
        visibility: hidden !important;
        margin-left: -16px !important;
}

.tabbrowser-tab:not([selected]):hover .tab-close-button {
        visibility: visible !important; 
        margin-left: 0px !important;
        display: -moz-box !important;
}

Place this file into the chrome folder inside your profile’s directory. Follow the directions from Mozilla to find out where to find the profile’s directory location.

Update 1: It just tried this again myself due to a fresh installation and you also need to change the browser.tabs.tabClipWidth preference from it’s default value (140) to 99.

Update 2 (August 2017): As pointed out by Veto in the comments below, this functionality is broken since version 55.0.3. The above CSS has been updated to stay compatible with the new Firefox UI.

Then just restart Firefox and you are done.

Source: Post on Neowin Forums

8 Comments

  1. Thanks, still working 🙂

  2. Nope, as of Firefox version 55.0.2 this has been broken. Most likely due to the new changes introduced to the plugin/appearance machinery. The new way of operation will be enforced as of November’s version 57, but why this beautiful gimmick has fallen victim so early in the game, while all the other “old” plugins seem ok, remains a mystery to me. An updated version, if possible, would be highly appreciated.

    • Well it kind of works, but only up to 12 tabs open. By the 13th tab it becomes unreliable, and 14 and up is simply put a solid broken.

      • Matthias Schoettle

        August 24, 2017 at 13:07

        Thanks for letting me know. You’re referring to the new Photon UI which is currently enabled in 55.0.2 nightly, right?

        I’ll have to look into it, maybe the structure changed. Out of curiosity, if you disable browser.photon.structure.enabled (i.e., set to false) in about:config, does it work properly again?

        • Actually it is set to “false” by default. I think they are not activating it as of yet. Also I am on 64bit firefox and the mod keeps being broken even if updated to 55.0.3. It must be something else they have changed.

    • Matthias Schoettle

      August 29, 2017 at 18:02

      Hi Veto, the post has been updated with a new version that works again (tested with 55.0.3 and 57.0.a1). I’ll write a separate post about the details.

  3. Yes, indeed I can confirm it works as good as before. Thanks

  4. Thanks. Still working without Update 1

Leave a Reply

Your email address will not be published.

*

© 2017 Matthias Schoettle

Theme by Anders NorenUp ↑