We're calling on all EU-based Mozillians with iOS or iPadOS devices to help us monitor Apple’s new browser choice screens. Join the effort to hold Big Tech to account!

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

How to hide tab close button

more options

Hello,

In past versions of firefox there was a config option to hide the tab close button but this got removed. I got accustomed to closing tabs with the mouse middle click so I don't need that button. It gets in the way when I try to switch tabs and I accidentally click it.

Is there a way to hide it in newer versions of firefox (56, 57)?

Thank you.

Hello, In past versions of firefox there was a config option to hide the tab close button but this got removed. I got accustomed to closing tabs with the mouse middle click so I don't need that button. It gets in the way when I try to switch tabs and I accidentally click it. Is there a way to hide it in newer versions of firefox (56, 57)? Thank you.

Chosen solution

You can add code to the userChrome.css file below the default @namespace line to hide the close buttons.


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

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


You can use the button on the "Help -> Troubleshooting Information" (about:support) page to go to the current Firefox profile folder or use the about:profiles page.

  • create the chrome folder (lowercase) in the <xxxxxxxx>.default profile folder if this folder doesn't exist
  • use a plain text editor like Notepad to create a (new) userChrome.css file in the chrome folder (file name is case sensitive)
  • paste the code in the userChrome.css file in the editor window
  • make sure that the userChrome.css file starts with the default @namespace line
  • make sure that you select "All files" and not "Text files" when you save the file via "Save file as" in the text editor as userChrome.css.
    otherwise Windows may add a hidden .txt file extension and you end up with a not working userChrome.css.txt file
Read this answer in context 👍 12

All Replies (3)

more options

Maybe you'd like to give this add-on a try - which does what the preference in 'about:config' used to do :

https://addons.mozilla.org/en-US/firefox/addon/no-close-buttons/

more options

Chosen Solution

You can add code to the userChrome.css file below the default @namespace line to hide the close buttons.


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

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


You can use the button on the "Help -> Troubleshooting Information" (about:support) page to go to the current Firefox profile folder or use the about:profiles page.

  • create the chrome folder (lowercase) in the <xxxxxxxx>.default profile folder if this folder doesn't exist
  • use a plain text editor like Notepad to create a (new) userChrome.css file in the chrome folder (file name is case sensitive)
  • paste the code in the userChrome.css file in the editor window
  • make sure that the userChrome.css file starts with the default @namespace line
  • make sure that you select "All files" and not "Text files" when you save the file via "Save file as" in the text editor as userChrome.css.
    otherwise Windows may add a hidden .txt file extension and you end up with a not working userChrome.css.txt file
more options

@Engima thanks for the answer, but addons that do that don't work starting with firefox 57. I'm on 57 beta and I could switch to 56 stable to use that addon but it would only postpone the problem.

@cor-el thank you, that worked. I hope Mozilla doesn't plan to remove userChrome.css any time soon.