首页 > IE的滤镜设置图片不支持绝对路径吗?

IE的滤镜设置图片不支持绝对路径吗?

使用IE的滤镜 filter想兼容background-size:cover,但在IE8中还是没有兼容?
图片并没有全屏显示,是否是filter不支持相对路径

.error_body{
    height: 100%;
    background-image:url(../images/404.png);
    background-size: cover; 
    background-position: center; 
    background-attachment:fixed;
    background-repeat:no-repeat;
    filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/404.png',sizingMethod='scale');  
    position: absolute;
    top: 0;
    left: 0;
    width: 100%; 
}

楼上大神说的,相对于页面的url而不是css文件的,还是不是很懂,提问的朋友的路径是相对css文件的,那么绝对路径是怎么写的,我也困住了


引用 MSDN 中的说明:

This attribute is always relative to page URL. So when you define AlphaImageLoader in CSS file you should use absolute path is src, but NOT relative to CSS file location (as for normal background images).

这个滤镜中的 src 属性永远相对于页面的 URL 而不是 CSS 文件的,所以最好用绝对路径。

background-size polyfill 能够解决 background-size 的兼容性问题。

【热门文章】
【热门文章】