搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

userChrome.css not working

more options

Hello,

I am wondering why userChrome.css is not loading. toolkit.legacyUserProfileCustomizations.stylesheets is set to true (about:config). I loaded userChrome.css opening the Profile Folder in about:support and dragging and dropping a "chrome" folder that contains userChrome.css respecting case sensitivity and file types. So the file now is under C:\Users\marce\AppData\Roaming\Mozilla\Firefox\Profiles\sv6gplmb.default-release-1681224431322\chrome. The css is simple, it is valid and it works in the Style Editor:

.search-wrapper .search-handoff-button, .search-wrapper input {

 background: var(--newtab-background-color-secondary) var(--newtab-search-icon) 16px center no-repeat;
 background-size: 24px;
 padding-inline-start: 52px;
 padding-inline-end: 10px;
 padding-block: 0;
 width: 100%;
 box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
 border: 1px solid transparent;
 border-radius: 8px;
 color: var(--newtab-text-primary-color);
 -moz-context-properties: fill;
 fill: var(--newtab-text-secondary-color);

}

.top-site-outer .tile {

 border-radius: 8px;
 box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
 background-color: var(--newtab-background-color-secondary);
 justify-content: center;
 margin: 0 auto;
 height: 80px;
 width: 80px;
 cursor: pointer;
 position: relative;
 align-items: center;
 color: var(--newtab-text-secondary-color);
 display: flex;
 font-size: 32px;
 font-weight: 200;
 text-transform: uppercase;

}

.ds-card-grid.ds-card-grid-border .ds-card:not(.placeholder) {

 border-radius: 8px;
 box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);

}

.card-outer .card {

 border-radius: 8px;
 box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
 height: 100%;

}

However, userChrome.css does show up on the left column in the style editor. Very odd. I restarted the browser of course.

Is this no longer supported? I am using Firefox (regular edition, not dev or nightly) and Windows 11.

Hope someone can help! Thanks in advance

Hello, I am wondering why userChrome.css is not loading. toolkit.legacyUserProfileCustomizations.stylesheets is set to true (about:config). I loaded userChrome.css opening the Profile Folder in about:support and dragging and dropping a "chrome" folder that contains userChrome.css respecting case sensitivity and file types. So the file now is under C:\Users\marce\AppData\Roaming\Mozilla\Firefox\Profiles\sv6gplmb.default-release-1681224431322\chrome. The css is simple, it is valid and it works in the Style Editor: .search-wrapper .search-handoff-button, .search-wrapper input { background: var(--newtab-background-color-secondary) var(--newtab-search-icon) 16px center no-repeat; background-size: 24px; padding-inline-start: 52px; padding-inline-end: 10px; padding-block: 0; width: 100%; box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32); border: 1px solid transparent; border-radius: 8px; color: var(--newtab-text-primary-color); -moz-context-properties: fill; fill: var(--newtab-text-secondary-color); } .top-site-outer .tile { border-radius: 8px; box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32); background-color: var(--newtab-background-color-secondary); justify-content: center; margin: 0 auto; height: 80px; width: 80px; cursor: pointer; position: relative; align-items: center; color: var(--newtab-text-secondary-color); display: flex; font-size: 32px; font-weight: 200; text-transform: uppercase; } .ds-card-grid.ds-card-grid-border .ds-card:not(.placeholder) { border-radius: 8px; box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32); } .card-outer .card { border-radius: 8px; box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32); height: 100%; } However, userChrome.css does show up on the left column in the style editor. Very odd. I restarted the browser of course. Is this no longer supported? I am using Firefox (regular edition, not dev or nightly) and Windows 11. Hope someone can help! Thanks in advance

被選擇的解決方法

That looks like code for the Firefox Home page and such CSS code should be in userContent.css. If the code isn't working then you may have to add the !important flag as it is possible that you need to override existing rules.


@-moz-document
  url-prefix(about:newtab),
  url-prefix(about:home) {
 .search-wrapper .search-handoff-button,
 .search-wrapper input {
  background: var(--newtab-background-color-secondary) var(--newtab-search-icon) 16px center no-repeat;
  background-size: 24px;
  padding-inline-start: 52px;
  padding-inline-end: 10px;
  padding-block: 0;
  width: 100%;
  box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--newtab-text-primary-color);
  -moz-context-properties: fill;
  fill: var(--newtab-text-secondary-color);
 }

 .top-site-outer .tile {
  border-radius: 8px;
  box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
  background-color: var(--newtab-background-color-secondary);
  justify-content: center;
  margin: 0 auto;
  height: 80px;
  width: 80px;
  cursor: pointer;
  position: relative;
  align-items: center;
  color: var(--newtab-text-secondary-color);
  display: flex;
  font-size: 32px;
  font-weight: 200;
  text-transform: uppercase;
 }

 .ds-card-grid.ds-card-grid-border .ds-card:not(.placeholder) {
  border-radius: 8px;
  box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
 }

 .card-outer .card {
  border-radius: 8px;
  box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
  height: 100%;
 }
}

從原來的回覆中察看解決方案 👍 0

所有回覆 (12)

more options

Shouldn't it be userContent.css?

more options

I believe it is userChrome.css for the NTP, userContent.css? for content... either way, I just added a minimal userContent.css and it doesn't load either. I am beginning to wonder if it only works in Firefox Developer, Firefox Nightly or it just doesn't work at all...

more options

選擇的解決方法

That looks like code for the Firefox Home page and such CSS code should be in userContent.css. If the code isn't working then you may have to add the !important flag as it is possible that you need to override existing rules.


@-moz-document
  url-prefix(about:newtab),
  url-prefix(about:home) {
 .search-wrapper .search-handoff-button,
 .search-wrapper input {
  background: var(--newtab-background-color-secondary) var(--newtab-search-icon) 16px center no-repeat;
  background-size: 24px;
  padding-inline-start: 52px;
  padding-inline-end: 10px;
  padding-block: 0;
  width: 100%;
  box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--newtab-text-primary-color);
  -moz-context-properties: fill;
  fill: var(--newtab-text-secondary-color);
 }

 .top-site-outer .tile {
  border-radius: 8px;
  box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
  background-color: var(--newtab-background-color-secondary);
  justify-content: center;
  margin: 0 auto;
  height: 80px;
  width: 80px;
  cursor: pointer;
  position: relative;
  align-items: center;
  color: var(--newtab-text-secondary-color);
  display: flex;
  font-size: 32px;
  font-weight: 200;
  text-transform: uppercase;
 }

 .ds-card-grid.ds-card-grid-border .ds-card:not(.placeholder) {
  border-radius: 8px;
  box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
 }

 .card-outer .card {
  border-radius: 8px;
  box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
  height: 100%;
 }
}

more options

TyDraniu said

Shouldn't it be userContent.css?

You were right. My appologies.

more options

TyDraniu said

Shouldn't it be userContent.css?

cor-el said

That looks like code for the Firefox Home page and such CSS code should be in userContent.css. If the code isn't working then you may have to add the !important flag as it is possible that you need to override existing rules.
@-moz-document
  url-prefix(about:newtab),
  url-prefix(about:home) {
 .search-wrapper .search-handoff-button,
 .search-wrapper input {
  background: var(--newtab-background-color-secondary) var(--newtab-search-icon) 16px center no-repeat;
  background-size: 24px;
  padding-inline-start: 52px;
  padding-inline-end: 10px;
  padding-block: 0;
  width: 100%;
  box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--newtab-text-primary-color);
  -moz-context-properties: fill;
  fill: var(--newtab-text-secondary-color);
 }

 .top-site-outer .tile {
  border-radius: 8px;
  box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
  background-color: var(--newtab-background-color-secondary);
  justify-content: center;
  margin: 0 auto;
  height: 80px;
  width: 80px;
  cursor: pointer;
  position: relative;
  align-items: center;
  color: var(--newtab-text-secondary-color);
  display: flex;
  font-size: 32px;
  font-weight: 200;
  text-transform: uppercase;
 }

 .ds-card-grid.ds-card-grid-border .ds-card:not(.placeholder) {
  border-radius: 8px;
  box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
 }

 .card-outer .card {
  border-radius: 8px;
  box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
  height: 100%;
 }
}

Thank you and TyDraniu

cor-el said

That looks like code for the Firefox Home page and such CSS code should be in userContent.css. If the code isn't working then you may have to add the !important flag as it is possible that you need to override existing rules.
@-moz-document
  url-prefix(about:newtab),
  url-prefix(about:home) {
 .search-wrapper .search-handoff-button,
 .search-wrapper input {
  background: var(--newtab-background-color-secondary) var(--newtab-search-icon) 16px center no-repeat;
  background-size: 24px;
  padding-inline-start: 52px;
  padding-inline-end: 10px;
  padding-block: 0;
  width: 100%;
  box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--newtab-text-primary-color);
  -moz-context-properties: fill;
  fill: var(--newtab-text-secondary-color);
 }

 .top-site-outer .tile {
  border-radius: 8px;
  box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
  background-color: var(--newtab-background-color-secondary);
  justify-content: center;
  margin: 0 auto;
  height: 80px;
  width: 80px;
  cursor: pointer;
  position: relative;
  align-items: center;
  color: var(--newtab-text-secondary-color);
  display: flex;
  font-size: 32px;
  font-weight: 200;
  text-transform: uppercase;
 }

 .ds-card-grid.ds-card-grid-border .ds-card:not(.placeholder) {
  border-radius: 8px;
  box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
 }

 .card-outer .card {
  border-radius: 8px;
  box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
  height: 100%;
 }
}

cor-el said

That looks like code for the Firefox Home page and such CSS code should be in userContent.css. If the code isn't working then you may have to add the !important flag as it is possible that you need to override existing rules.
@-moz-document
  url-prefix(about:newtab),
  url-prefix(about:home) {
 .search-wrapper .search-handoff-button,
 .search-wrapper input {
  background: var(--newtab-background-color-secondary) var(--newtab-search-icon) 16px center no-repeat;
  background-size: 24px;
  padding-inline-start: 52px;
  padding-inline-end: 10px;
  padding-block: 0;
  width: 100%;
  box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--newtab-text-primary-color);
  -moz-context-properties: fill;
  fill: var(--newtab-text-secondary-color);
 }

 .top-site-outer .tile {
  border-radius: 8px;
  box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
  background-color: var(--newtab-background-color-secondary);
  justify-content: center;
  margin: 0 auto;
  height: 80px;
  width: 80px;
  cursor: pointer;
  position: relative;
  align-items: center;
  color: var(--newtab-text-secondary-color);
  display: flex;
  font-size: 32px;
  font-weight: 200;
  text-transform: uppercase;
 }

 .ds-card-grid.ds-card-grid-border .ds-card:not(.placeholder) {
  border-radius: 8px;
  box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
 }

 .card-outer .card {
  border-radius: 8px;
  box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32);
  height: 100%;
 }
}

Thank you TyDraniu and cor-el ! It does work. Yes, it was userContent.css and I also needed to add the important flag.

more options

You're welcome.

Can you post your CSS code updated with !important in case other want to use it ?

more options

cor-el said

You're welcome. Can you post your CSS code updated with !important in case other want to use it ?


Sure, I just added more prominent drop shadows to shortcuts, pocket recommendations and recent activity using: box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32) !important;

Here is the full code:


@-moz-document

 url-prefix(about:newtab),
 url-prefix(about:home) {
.search-wrapper .search-handoff-button,
.search-wrapper input {
 background: var(--newtab-background-color-secondary) var(--newtab-search-icon) 16px center no-repeat;
 background-size: 24px;
 padding-inline-start: 52px;
 padding-inline-end: 10px;
 padding-block: 0;
 width: 100%;
 box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32) !important;
 border: 1px solid transparent;
 border-radius: 8px;
 color: var(--newtab-text-primary-color);
 -moz-context-properties: fill;
 fill: var(--newtab-text-secondary-color);
}
.top-site-outer .tile {
 border-radius: 8px;
 box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32) !important;
 background-color: var(--newtab-background-color-secondary);
 justify-content: center;
 margin: 0 auto;
 height: 80px;
 width: 80px;
 cursor: pointer;
 position: relative;
 align-items: center;
 color: var(--newtab-text-secondary-color);
 display: flex;
 font-size: 32px;
 font-weight: 200;
 text-transform: uppercase;
}
.ds-card-grid.ds-card-grid-border .ds-card:not(.placeholder) {
 border-radius: 8px;
 box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32) !important;
}
.card-outer .card {
 border-radius: 8px;
 box-shadow: 12px 12px 6px rgba(0, 0, 0, 0.32) !important;
 height: 100%;
}

}

more options

You are welcome. Here is the one I ended up using. It makes the word "Firefox" a bit bigger, it removes the logo (nothing wrong with it but I like it better this way) and the drop shadows are more subtle. It is the one I ended up using.

.search-wrapper .search-handoff-button, .search-wrapper input {

   background: var(--newtab-background-color-secondary) var(--newtab-search-icon) 16px center no-repeat;
   background-size: 24px;
   padding-inline-start: 52px;
   padding-inline-end: 10px;
   padding-block: 0;
   width: 100%;
   box-shadow: 6px 6px 3px rgba(0, 0, 0, 0.32) !important;
   border: 1px solid transparent;
   border-radius: 8px;
   color: var(--newtab-text-primary-color);
   -moz-context-properties: fill;
   fill: var(--newtab-text-secondary-color);
 }
 
 .top-site-outer .tile {
   border-radius: 8px;
   box-shadow: 6px 6px 3px rgba(0, 0, 0, 0.32) !important;
   background-color: var(--newtab-background-color-secondary);
   justify-content: center;
   margin: 0 auto;
   height: 80px;
   width: 80px;
   cursor: pointer;
   position: relative;
   align-items: center;
   color: var(--newtab-text-secondary-color);
   display: flex;
   font-size: 32px;
   font-weight: 200;
   text-transform: uppercase;
 }
 
 .ds-card-grid.ds-card-grid-border .ds-card:not(.placeholder) {
   border-radius: 8px;
   box-shadow: 6px 6px 3px rgba(0, 0, 0, 0.32) !important;
 }
 
 .card-outer .card {
   border-radius: 8px;
   box-shadow: 6px 6px 3px rgba(0, 0, 0, 0.32) !important;
   height: 100%;
 }
 
 .search-wrapper .search-inner-wrapper {
   display: none !important;
 }
 .search-wrapper .logo-and-wordmark .logo {
   display: none !important;
 }
 .search-wrapper .logo-and-wordmark .wordmark {
   background: url("chrome://branding/content/firefox-wordmark.svg") no-repeat center center;
     background-size: auto;
   background-size: 200px !important;
   -moz-context-properties: fill;
   display: inline-block;
   fill: var(--newtab-wordmark-color);
   height: 82px;
   margin-inline-start: 0px !important;
   width: 200px !important;
 }
more options

Note that there is a pref for showing the logo on the Firefox Home page.

  • about:config => browser.newtabpage.activity-stream.logowordmark.AlwaysVisible
more options

cor-el said

Note that there is a pref for showing the logo on the Firefox Home page.
  • about:config => browser.newtabpage.activity-stream.logowordmark.AlwaysVisible

That is cool, however, it do want to see the word "Firefox".

more options

And along came the 111. 3 update and messed everything up... So everyone knows...