為了改善您的使用體驗,本網站正在進行維護,部分功能暫時無法使用。若本站的文件無法解決您的問題,想要向社群發問的話,請到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 發問,我們的社群成員將很快會回覆您的疑問。

搜尋 Mozilla 技術支援網站

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

了解更多

list-style-image property not working in userChrome.css

  • 8 回覆
  • 2 有這個問題
  • 10 次檢視
  • 最近回覆由 tbrammer

more options

All,

I'm struggling to replace an icon for the home button in Firefox 38.

In userChrome.css I've got the following:

  1. home-button {
 list-style-image: url("mainhome.png") !important;
 -moz-image-region: rect(0 16px 16px 0) !important;

}

The mainhome.png file is right in the chrome directory of the profile and readable. Despite that, the home icon is blank; if I remove the line, the default icon shows, so I know I have the name right. Am I referencing the image incorrectly? I'm not sure what I'm doing wrong, but in FF25 I just used:

  1. home-button { list-style-image: url("mainhome.png") !important; }

and it worked like a charm.

Thanks for any help in advance.

All, I'm struggling to replace an icon for the home button in Firefox 38. In userChrome.css I've got the following: #home-button { list-style-image: url("mainhome.png") !important; -moz-image-region: rect(0 16px 16px 0) !important; } The mainhome.png file is right in the chrome directory of the profile and readable. Despite that, the home icon is blank; if I remove the line, the default icon shows, so I know I have the name right. Am I referencing the image incorrectly? I'm not sure what I'm doing wrong, but in FF25 I just used: #home-button { list-style-image: url("mainhome.png") !important; } and it worked like a charm. Thanks for any help in advance.

所有回覆 (8)

more options

The toolbar icon are in this file:

  • chrome://browser/skin/Toolbar.png

The CSS rules are here:

  • chrome://browser/skin/browser.css

Try this code:

#home-button {
 list-style-image: url("mainhome.png") !important;
 -moz-image-region: auto !important;
}
more options

Hey cor-el,

Thanks for your quick response. Unfortunately this didn't have an effect. I'm certain that I'm referencing the button correctly, as the !important tag causes it to become a blank button. The issue appears to be in the way I'm referencing the image. I've also posted this at the MozillaZine forums, so I'll report back if I make any progress.

more options

Are you using the default Firefox theme?

Are you sure that the image is a valid PNG image?

Can you open the image in a Firefox tab?

more options

I'm using the default theme, and I'm able to open the image. It shows as 60x60, is that too big?

This is for a touchscreen kiosk so the idea is to have the buttons be big enough to touch comfortably.

more options

If the image is 60x60 then you will only see part of it with -moz-image-region: rect(0 16px 16px 0) The -moz-image-region:auto setting like I posted above should show the full image, but likely won't look good (image will look stretched). This was likely used in Firefox 25 that had a single standalone image for this button.

You would have to re-save te image with the correct dimensions.

more options

Hi core-el,

I went ahead and save the image 16x16 and still a no go. I'm not sure whats happened, but I think the method of applying an icon to a button has changed and I'm just not finding it in my searches. Are you able to use the code you provided me to change an icon anything 38 or newer?

more options

I've tested the code with an image in the chrome folder and that worked for me on Linux with Firefox 41. The DOM Inspector also doesn't show any changes in the DOM tree structure.

more options

Cor-el,

Thanks again for all your help. I'll try updating and see how it goes.