ie6显示透明背景的图像(.PNG)背景色

时间:2011-02-14 07:35:53

标签: html css png transparency internet-explorer-6

大家好,我有一个问题,图像显示IE6上的背景颜色,它应该是一个透明的背景。在所有其他浏览器上,除IE6外,它显示正常。

任何人都可以告诉我,我做错了什么。尝试将不透明度设为0,但仍显示背景颜色。

3 个答案:

答案 0 :(得分:3)

修复非常简单。无需包含任何JavaScript。像这样定义你的css并在过滤器中包含你的图像名称。

.whatever {
    background: none; /* Hide the current background image so you can replace it with the filter*/
    width: 500px; /* Must specify width */
    height: 176px; /* Must specify height */
    filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='vehicles.png');
}

答案 1 :(得分:0)

IE6不支持半透明PNG。如果你真的需要,可以试试这样的事情:

http://css-tricks.com/snippets/css/png-hack-for-ie-6/http://www.jay-han.com/2008/10/15/unit-png-fix-best-ie-png-hack/

或者只是放弃IE6,它落后于所有其他浏览器,并迅速失去市场。

答案 2 :(得分:0)

IE6不能正确支持透明PNG。

This page有一个涉及行为文件的修复程序。或者,您可以使用GIF。