搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

How do I hide the close X on all tabs (including the active tab)?

  • 16 个回答
  • 1 人有此问题
  • 13 次查看
  • 最后回复者为 ender21

more options

Currently, the X doesn't show on tabs other than the active tab. Ideally, I don't want the X on the active tab either. The stanza I am using in userChrome.css is

.tab-close-button{ display: none !important } (suggested in a post in GitHub) This is the current stanza and doesn't hide the X on the active tab.

I have tried setting the value of browser.tabs.tabClipWidth to 9999 as suggested in another question and that doesn't get rid of the X on the active tab. I have also tried the following css solution :

#tabbrowser-tabs .tabbrowser-tab .tab-close-button { display:none!important; }
(also suggested in another question but it doesn't hide the X on the active tab)

I searched for an extension and got a lot of links; I looked through the first three pages and nothing relevant was listed.

Currently, the X doesn't show on tabs other than the active tab. Ideally, I don't want the X on the active tab either. The stanza I am using in userChrome.css is <pre>.tab-close-button{ display: none !important } (suggested in a post in GitHub) This is the current stanza and doesn't hide the X on the active tab.</pre> I have tried setting the value of browser.tabs.tabClipWidth to 9999 as suggested in another question and that doesn't get rid of the X on the active tab. I have also tried the following css solution : <pre>#tabbrowser-tabs .tabbrowser-tab .tab-close-button { display:none!important; }</pre> (also suggested in another question but it doesn't hide the X on the active tab) I searched for an extension and got a lot of links; I looked through the first three pages and nothing relevant was listed.

由ender21于修改

被采纳的解决方案

What worked is using two stanzas together, thus :

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

I also tried using the second stanza alone; that didn't work.

定位到答案原位置 👍 0

所有回复 (16)

more options

For css usage you should contact the site that created the css your using for how they configure changes from the default FF settings.

more options

That code should work.

Are you sure that there isn't a problem with the userChrome.css file you created?


Add code to the userChrome.css file below the default @namespace line.


@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}

It is not that difficult to create userChrome.css if you have never used it.

The first step is to open the "Help -> Troubleshooting Information" page and find the button to access the profile folder.

You can find this button under the "Application Basics" section as "Profile Folder -> Open Folder". If you click this button then you open the profile folder in the Windows File Explorer. You need to create a folder with the name chrome in this folder (name is all lowercase). In the chrome folder you need to create a text file with the name userChrome.css (name is case sensitive). In this userChrome.css text file you paste the text posted.

In Windows saving the file is usually the only time things get more complicated because Windows can silently add a .txt file extension and you end up with a file named userChrome.css.txt. To avoid this you need to make sure to select "All files" in the dialog to save the file in the text editor using "Save File as". Check that the file doesn't have a double .css file extension (userChrome.css.css).

You need to close and restart Firefox when you create or modify the userChrome.css file.

more options

Thanks for the replies. I know how to create a userChrome.css file. I have been using one for years. It doesn't have a double .css extension. I restarted after trying each option.

more options

I have just re-added the following stanza (and commented out the other) after exiting Firefox then restarted Firefox. The X is still on the active tab.

more options

Does other code in the file work?

Firefox would normally hide the close X on other tabs in case a lot of tabs are open, so may test this with only two of three tabs open.


Can you attach a screenshot that shows this file?

more options

Thanks for replying. Most of the code in the file works. There are two stanzas relating to the colours of tabs which don't work as expected.

I currently have 20 tabs open. I suppose you don't want a screen shot of the width of the screen so my screen shot shows only the active tab and two tabs on either side.

more options

Somewhere in a built-in style sheet for Windows, I found a rule that had a more detailed (more specific) chain, so I have been using this to modify the tab close button. You could try it with your display:none preference:

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

Please do not trust email confirmations with CSS, always copy from the forum. Especially because we sometimes notice a typo and fix it here, but no new email is generated.

more options

jscher2000 said

Somewhere in a built-in style sheet for Windows, I found a rule that had a more detailed (more specific) chain, so I have been using this to modify the tab close button. You could try it with your display:none preference:
#tabbrowser-tabs > .tabbrowser-tab > .tab-stack > .tab-content > .tab-close-button {
  display: none !important;
}

Please do not trust email confirmations with CSS, always copy from the forum. Especially because we sometimes notice a typo and fix it here, but no new email is generated.

Thanks. I have copied that code. What do you mean by "with your display:none preference"? Is your code to be used along with the following?

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

I have just noticed that there is no space between 'none' and'!' I'll fix that and restart. No, adding a space made no difference.

由ender21于修改

more options

Try using a space between none and !important

none !important

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

the-edmeister said

Try using a space between none and !important none !important
#tabbrowser-tabs .tabbrowser-tab .tab-close-button 
{display:none !important} 

Thanks. I made that change earlier (after exiting Firefox) and restarted Firefox. The change made no difference.

more options

ender21 said

jscher2000 said
#tabbrowser-tabs > .tabbrowser-tab > .tab-stack > .tab-content > .tab-close-button {
  display: none !important;
}
Thanks. I have copied that code. What do you mean by "with your display:none preference"? Is your code to be used along with the following?

No additional rules needed. What I posted is a complete solution for hiding all tab close buttons, tested on Firefox 61 on Windows 7.

more options

选择的解决方案

What worked is using two stanzas together, thus :

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

I also tried using the second stanza alone; that didn't work.

由ender21于修改

more options

Use <pre> before and </pre> after code blocks.

For some reason, there is a closing } missing after the second rule.

more options

jscher2000 said

Use <pre> before and </pre> after code blocks. For some reason, there is a closing } missing after the second rule.

Thanks. Edited accordingly.

more options

It is not necessary to leave a space before and after the "!", it should work either way. The Firefox source code use these spaces to make it easier to spot the important flag (display: none ! important;)

Did you test the code with only two or three tabs open like I suggested above?

more options

cor-el said

It is not necessary to leave a space before and after the "!", it should work either way. The Firefox source code use these spaces to make it easier to spot the important flag (display: none ! important;) Did you test the code with only two or three tabs open like I suggested above?

Thanks. I didn't test the code with only two or three tabs open. Is there any need for that now that I have code that works? I always save the session when exiting so I would have to close tabs I want to save.