Firefox 3.x 中的 PNG 背景图像消失且无法加载
问题是这样的:
我有一个 div (#bottom),它不是浮动的,它在 CSS 中具有预定义的高度(24px;),它用于显示其背景 (bottom.png),直到我在里面放入一些东西。
CSS:
#bottom {height: 24px; background-image: url("bottom.png");}
HTML:
<div id="bottom">
<div id="somethingInside">
</div>
</div>
现在FF 3.x不加载背景图片!我可以将同一页面上使用的另一个图像放在同一个 html 文件中,并让 CSS 使用它作为 #bottom div 的背景图像,然后它会显示在那里。
但即使我在 FF 上下文菜单中单击“显示背景图像”或输入 Bottom.png 路径,我也无法在浏览器中加载图像。相反,那里只显示了 Bottom.png 文件的路径...如果我使用 gif 文件,那么一切都会正常工作。当我使用 PNG 时,它不起作用。
如果我将bottom.png重命名为whatever.png,它也不会加载。如果我在同一文件中的其他任何地方调用 Bottom.png 作为背景,它就不起作用。
如果我从 div#bottom 中删除 div#somethinginside,问题仍然存在。
当我将bottom.png作为 包含到 div#bottom 中后,一切都发生了变化,然后背景返回,显示了,但我在下面使用了一些其他 png文件中消失了。
这是迄今为止我遇到过的最烦人的现象,因为我找不到任何解释。看起来 Firefox 将该文件或其他东西列入了黑名单,但这听起来可能很愚蠢。
这不是路径问题:我在同一文件夹中有很多文件。 这不是 CSS 问题中 url("myUrl") 中的“/”:我复制/粘贴有效文件的路径。 我总是通过 Photoshop 中的“另存为网页”进行保存。无论我是否使用 PNG 8 和 PNG 24 图像,都会发生同样的情况。 我正在本地服务器 XAMPP 上工作。 我正在使用 Joomla。和 Windows XP 专业版。它只发生在 Firefox 中,目前对我来说是 3.5.7。在 IE8 中不是问题。
有人遇到过这样的问题吗?我什至无法按需重现它,因为我什至不知道是什么导致了这种奇怪的行为。由于某种原因,它主要适用于 PNG 文件。这是第二次发生这种情况,而且是一个完全不同的项目。 PNG/Firefox 有错误吗?
The problem is this:
I have a div (#bottom), which is NOT floated, which has a pre-defined height in CSS (of 24px;), which USED TO display its background (bottom.png) until I put something inside.
CSS:
#bottom {height: 24px; background-image: url("bottom.png");}
HTML:
<div id="bottom">
<div id="somethingInside">
</div>
</div>
Now FF 3.x does not LOAD the background image! I can put another image used on the same page, within the same html file, and make CSS use it as a background image for that #bottom div and then it shows up there.
But I can't load the image in the browser EVEN if I click "show background image" in FF context menu or when I enter the bottom.png path. Instead only the path to the bottom.png file shows there... If I use a gif file than everything works fine. When I use a PNG, then it doesn't work.
If I rename the bottom.png to whatever.png, it does not load either. If I invoke bottom.png as a background anywhere else in the same file, it doesn't work.
If I remove the div#somethinginside from div#bottom, the problem persists.
It all changed after I included bottom.png into div#bottom as <img src="bottom.png" />
, then the background returned, the was displayed but some other pngs I used below in the file disappeared.
This is by far the most annoying phenomena I have ever encountered, as I can't find any explanation for that. It looks as if Firefox blacklisted that file or something, stupid it may sound, though.
It's not a path issue: i have many files in the same folder.
It's not a '/" in url("myUrl") in CSS issue: I copy/paste paths for files that do work.
I always save via Save for web in Photoshop. The same happens, irrespective of whether I'm using PNG 8 and PNG 24 images.
I'm working on a local server, XAMPP.
I'm using Joomla. And Windows XP Pro. And it ONLY happens in Firefox, currently 3.5.7 for me. Not an issue in IE8.
Has anyone encountered a problem like that? I can't even reproduce it on demand since i don't even know what's causing this strange behavior. And it applies mostly to PNG files for some reason. It's the second time this happens, and it's a completely different project. Is there some PNG/Firefox bug?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 Firefox,这很简单,只需使用 firebug 即可查看发生了什么。
顺便问一下,您在 Firefox 的安全模式下尝试过吗?也许这是一个造成麻烦的附加组件。
它适用于哪些浏览器(和版本)?
With Firefox it´s easy, just use firebug to see what´s happening.
By the way, have you tried it in Firefox in Safe Mode? Perhaps it´s an add-on that´s causing trouble.
And with what browsers (and versions) does it work?