为什么 IE6 不能显示带有 alpha 滤镜的半透明 png8 文件?
-- 在回答之前阅读整个问题 --
嗨,我在一个大网站上工作,该网站有很多(45000+)png24 图像(半透明)。
我将它们转换为 png8 并且效果非常好(对页面加载时间有很大帮助......)。
问题是我必须为 ie6 用户保留 png24 文件(使用 alpha 过滤器具有半透明像素),因为我们都知道我们不能在 IE6 中使用 png 8 半透明图像: 半透明像素将是不透明的或完全透明的。
我尝试对 png8 图像使用 alpha 图像加载器过滤器,但它不起作用,像素仍然不透明/完全透明,没有半透明。
不工作的原因是什么? IE 在处理 png24 或 png8 的半透明像素时有区别吗?
我在 msdn 网站或 stackoverflow 上找不到任何信息...
这太疯狂了...!
免责声明:我不是在寻找 af**ckin 修复 IE6 png 或类似的东西,我已经知道 alpha 图像加载器或 htc 技术等,这些都适用于 PNG24 文件,但不适用于 png8 文件。
-- read the whole question before answering --
Hi, i work on a big website that had a lot (45000+) of png24 images (with semi transparency).
I converted them to png8 and it works very well (a big help on page load time...).
The thing is i had to keep png24 files for ie6 users (with alpha filter to have semi transparent pixels) because we all know that we can't use png 8 semi transparent images in IE6 :
either the semi transparent pixels will be opaque or completely transparent.
I tried to use the alpha image loader filter with png8 images but it just don't work, the pixels are still opaque/completely transparent, no semi transparency.
What's the reason it's not working ? Is there a difference for IE when dealing with semi transparent pixels from a png24 or from a png8 ?
I couldn't find any information on msdn websites or on stackoverflow...
This is crazy... !
DISCLAIMER : i'm not searching for a f**ckin fix IE6 png or sh*t like that, i already know alpha image loader or htc techniques etc, theses all works well with PNG24 files but doesn't work with png8 files.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
因为IE6又老又垃圾。
我读这篇文章已经有一段时间了,但它可能会有所帮助(我不记得了):http: //www.alistapart.com/articles/pngopacity/
G.
Because IE6 is old and crap.
It's been a while since I read this article but it may help (I can't remember): http://www.alistapart.com/articles/pngopacity/
G.
即使您找到了解决方案,IE6 处理 PNG 半透明的 hack 也非常消耗 CPU。
更好的解决方案是让你的 PNG8 “IE6 友好”,否则你只会用 5~10 个 PNG 图像杀死你的 IE6
http://www.sitepoint.com/blogs/2008/03/20/making-ie6-friend-png8-images/
Even if you find a solution, the IE6 hack to handle semi transparency with PNG is extremely CPU consumming.
The better solution is to make your PNG8 "IE6-friendly" or you will kill your IE6 with only 5~10 PNG images
http://www.sitepoint.com/blogs/2008/03/20/making-ie6-friendly-png8-images/
最后,“为什么 IE6 不能显示 X”这个问题的答案很简单,“因为 IE6 没有显示 X 的代码”。几乎任何功能,即使是像这样小而琐碎的功能,都需要编写、审查和测试代码,至少达到不留下可怕错误的程度。
我们可以推测 PNG8 走了多远。他们是否已经开始编码,或者是否遇到了有时会导致 IE6 崩溃的棘手错误?这可能很有趣,但实际上没有用。
In the end, the answer to the question "Why can’t IE6 show X" is simply "because IE6 does not have code to show X". Almost any feature, even those as small and trivial as this, require code to be written, reviewed and tested at least to the point where there are no horrible bugs left.
We can speculate how far PNG8 came. Did they even start coding, or did they encounter a tricky bug that crashed IE6 at times? That might be entertaining, but really not useful.
使用超级滑行。很棒的 jQuery 插件!
http://allinthehead.com/retro/338/supersleight-jquery-plugin
我是一名设计师,有时如果不使用透明度就无法逃脱,而且我仍然必须支持 IE6,这很痛苦,但这个插件对我帮助很大!
Use Supersleight. Great jQuery plugin!
http://allinthehead.com/retro/338/supersleight-jquery-plugin
I am a designer and sometimes you just cannot get away without using transparency and I HAVE to support IE6 still which is a pain, but this plugin has helped me a lot!