userChrome.css not working
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)
Shouldn't it be userContent.css?
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...
选择的解决方案
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%; } }
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.Thank you and TyDraniu
@-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%; } }
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.
You're welcome.
Can you post your CSS code updated with !important in case other want to use it ?
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%; }
}
Thanks.
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; }
Note that there is a pref for showing the logo on the Firefox Home page.
- about:config => browser.newtabpage.activity-stream.logowordmark.AlwaysVisible
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".
And along came the 111. 3 update and messed everything up... So everyone knows...