Css IE修复png不工作

Css IE修复png不工作,css,xhtml,internet-explorer-6,Css,Xhtml,Internet Explorer 6,有人知道为什么下面的代码不起作用吗?我真的很想使用这个方法,而不是任何JavaScript方法。我也尝试了绝对路径,但没有运气 .test { width: 500px; /* Must Specify Width */ height: 176px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='../images/test-bg.png'); } 我

有人知道为什么下面的代码不起作用吗?我真的很想使用这个方法,而不是任何JavaScript方法。我也尝试了绝对路径,但没有运气

.test {
    width: 500px; /* Must Specify Width */
    height: 176px;
    filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='../images/test-bg.png');
}

我认为
sizingMethod=scale
需要是
sizingMethod=“scale”

我知道您尝试了一条绝对路径,但您是否尝试了来自域(不包括域)的路径

因此,如果完整路径为“http://www.example.co.uk/images/test.png“您只需使用“/images/test.png”

这就是我过去使用它的方式

试试:


filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/test bg.png',sizingMethod=scale,enabled=“true”)

与CSS文件中的其他文件引用不同,
filter
属性的
src
属性与浏览器中的URL相关。因此,对于示例代码,假设images文件夹位于
http://www.yoursite.com/images
而您使用的
src
。/images/test bg.png

http://www.yoursite.com/                                -> Doesn't work
http://www.yoursite.com/some-page/                      -> Works
http://www.yoursite.com/some-page/another-level-deeper/ -> Doesn't work
最好的方法是使用相对于根的路径,如下所示:

filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/test bg.png',sizingMethod='scale')


如果这不是问题,另一种可能是图像的大小可能太小。在过去,我发现拉伸1x1像素的图像可能有问题,有时无法正确渲染。此实例中的一个解决方法是使用更大的图像(超过5x5像素)。

确保路径是相对于它所显示的页面,而不是CSS文件。你试过src='/images/test bg.png'?