开发者社区> 问答> 正文

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%; 
}

展开
收起
杨冬芳 2016-06-03 10:21:03 1960 0
1 条回答
写回答
取消 提交回答
  • IT从业

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

    2019-07-17 19:26:07
    赞同 展开评论 打赏
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载