为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

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

详细了解

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

  • 8 个回答
  • 2 人有此问题
  • 4 次查看
  • 最后回复者为 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.