要在 CSS 中添加哪些代码才能让 Firefox 读取具有透明背景的 PNG 图像
我设计了一个包含大量 PNG 图像的网站。除 Firefox 之外的所有浏览器都能正确显示它们。 Firefox 不会将它们的背景读取为透明,而是在它们周围放置幽灵框。我可以添加代码以使 Firefox 正确显示 PNG 图像吗?
I designed a website with a lot of PNG images. All browsers except for Firefox display them properly. Firefox doesn't read their background as transparent but puts ghost boxes around them. Is there code that I can add to cause Firefox to properly display the PNG images?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果 PNG 显示不同,这是因为您将 Firefox 设置为使用嵌入的颜色配置文件显示图像,而其他浏览器则不然。在这种情况下,prodigitalson 是正确的,因为您的图像并不是真正透明的。
不过,指向您页面的链接会更有帮助。
If PNG's are displaying differently it's because you have Firefox set to display images using their embedded color profiles where your other browsers are not. In which case prodigitalson would be correct in that your images are not truly transparent.
A link to your page would be much more helpful though.
这与 Firefox 能否正确显示图像无关。这是 iWeb 插入到您的页面中的一些 JavaScript(第一步:停止使用 iWeb)以在图像周围放置这些边框。 Firefox 在透明 PNG 周围放置边框/阴影,这就是为什么图像看起来有一个边界框,并给您图像具有不同背景的印象。
从页面中删除 JavaScript(您不需要它)并使用 CSS 设置图像边框的样式。
This has nothing to do with Firefox's ability to display images properly. This is some JavaScript that iWeb is inserting into your page (first step: stop using iWeb) to put those borders around your images. Firefox is putting the borders/shadows around your transparent PNG's which is why it looks like the image has a bounding box and giving you the impression the images have a different background.
Remove the JavaScript from your page (you don't need it) and style your image borders using CSS.