当サイトはユーザー体験を改善するためのメンテナンスを実施中に機能が制限される予定です。記事を読んでもあなたの問題が解決せず質問をしたい場合は、Twitter の @FirefoxSupport、Reddit の /r/firefox で、サポートコミュニティが皆さんを助けようと待機しています。

Mozilla サポートの検索

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.

詳しく学ぶ

このスレッドはアーカイブに保管されました。 必要であれば新たに質問してください。

userChrome.css code for changing active tab colour

  • 5 件の返信
  • 1 人がこの問題に困っています
  • 1 回表示
  • 最後の返信者: cor-el

more options

I've just been customising Firefox's look by selecting the dark theme (which appears to be the only way to get some things like the dark NTP), then using userChrome.css to alter various elements to what I want. I don't actually 'know' CSS but searching has found the code to copy into my userChrome.css and then edit the colour values for almost everything. I've changed the toolbar, tabs toolbar, url bar, bookmark bar, menus, context menus, everything I wanted ... except one thing. The background colour of the active tab (just the actual tab in the tabs bar) is stubbornly staying the colour it gets from the Mozilla Dark theme, and I want to change it to the (slightly different) shade of grey that I've changed the toolbar to. Can somebody please tell me what the lines are to put in userChrome.css to change the background colour of the active tab? Thanks.

I've just been customising Firefox's look by selecting the dark theme (which appears to be the only way to get some things like the dark NTP), then using userChrome.css to alter various elements to what I want. I don't actually 'know' CSS but searching has found the code to copy into my userChrome.css and then edit the colour values for almost everything. I've changed the toolbar, tabs toolbar, url bar, bookmark bar, menus, context menus, everything I wanted ... except one thing. The background colour of the active tab (just the actual tab in the tabs bar) is stubbornly staying the colour it gets from the Mozilla Dark theme, and I want to change it to the (slightly different) shade of grey that I've changed the toolbar to. Can somebody please tell me what the lines are to put in userChrome.css to change the background colour of the active tab? Thanks.

選ばれた解決策

Thanks for answering. I'd been trying lots of things I found in different places Googling, with the last not working one being:

.tab-background[selected="true"] {
      background-color: #3B3B3B !important;
    }

which puzzled me as the:

.tab-line[selected="true"] {
      background-color: red !important;
   }

from the same source DID work (not helpful to me as that line was one of the few things I didn't want to change!)

However, more Googling eventually came up with a thread on Reddit from someone about a year ago saying that last one I tried had previously worked but had just then stopped working, and there was a reply saying actually it does work but there's a background-image being drawn over it so adding a line to make it this works:

  .tab-background[selected="true"] {
      background-color: #3B3B3B !important;
      background-image: none !important;
    }

And indeed that has finally given me what I want. (Basically I've made Firefox look like the chromium Edge's Dark mode, which I like, including all the menus and panels - and a few extensions altered to match - along with dark mode about: pages and NTP. It was driving me nuts that I'd got everything else, just that one tab the wrong shade of grey to match the toolbar.)

As I say I've now got a working solution, but I'll have a look at what you suggested, and the Browser Toolbox, to help me to actually understand this. At the moment I'm blundering around, able to see from names what bits are affecting what, where the colour parameters etc are, but with no understanding of the syntax etc to be able to write sections rather than just copy from some post, paste, edit a colour value, then scratch my head as to why something's not working.

この回答をすべて読む 👍 0

すべての返信 (5)

more options

What have you tried so far? Maybe this will do what you want:

.tabbrowser-tab[selected="true"] .tab-background {
  background: #369 none !important;
}
more options

By the way, if you aren't using the Browser Toolbox to "inspect" the toolbar area, it's very helpful:

https://developer.mozilla.org/docs/Tools/Browser_Toolbox

more options

選ばれた解決策

Thanks for answering. I'd been trying lots of things I found in different places Googling, with the last not working one being:

.tab-background[selected="true"] {
      background-color: #3B3B3B !important;
    }

which puzzled me as the:

.tab-line[selected="true"] {
      background-color: red !important;
   }

from the same source DID work (not helpful to me as that line was one of the few things I didn't want to change!)

However, more Googling eventually came up with a thread on Reddit from someone about a year ago saying that last one I tried had previously worked but had just then stopped working, and there was a reply saying actually it does work but there's a background-image being drawn over it so adding a line to make it this works:

  .tab-background[selected="true"] {
      background-color: #3B3B3B !important;
      background-image: none !important;
    }

And indeed that has finally given me what I want. (Basically I've made Firefox look like the chromium Edge's Dark mode, which I like, including all the menus and panels - and a few extensions altered to match - along with dark mode about: pages and NTP. It was driving me nuts that I'd got everything else, just that one tab the wrong shade of grey to match the toolbar.)

As I say I've now got a working solution, but I'll have a look at what you suggested, and the Browser Toolbox, to help me to actually understand this. At the moment I'm blundering around, able to see from names what bits are affecting what, where the colour parameters etc are, but with no understanding of the syntax etc to be able to write sections rather than just copy from some post, paste, edit a colour value, then scratch my head as to why something's not working.

more options

Hi DavidBE, you see the difference between old and new rules --

  .tab-background[selected="true"] {
    background-color: #3B3B3B !important;
    background-image: none !important;
  }

-- the new one knocks out the background image which Firefox shows in front of the background color.

In mine, I used the short-hand method of doing that, but it is clearer when everything is spelled out.

more options

With the background shorthand properly you can set several properties at once, so you do not need to set (override) some properties like color and image separately.