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%; 
}
阅读 3.9k
2 个回答

引用 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 的兼容性问题。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题