background-size:cover兼容IE8的方法
2017-04-27 11:16
113 查看
background-size: cover;
可以通过滤镜filter来兼容IE8,实现相似的效果。
-ms-filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='图片地址',sizingMethod='scale')"; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='图片地址',sizingMethod='scale');
其中的图片地址最好使用绝对地址。
以下是参考文档中所说的内容:
If you want opacity to work in all versions of IE, the order should be as follows:
.opaque { /* Theoretically for IE 8 & 9 (more valid) */ /* ...but not required as filter works too */ /* should come BEFORE filter */ -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; // IE8 /* This works in IE 8 & 9 too */ /* ... but also 5, 6, 7 */ filter: alpha(opacity=50); // IE 5-7 /* Modern Browsers */ opacity: 0.5; }
If you don’t use this order, IE8-as-IE7 doesn’t apply the opacity, although IE8 and a pure IE7 do.
也就是说需要按照
-ms-filter -> filter -> opacity这样的顺序来写,这样才能保证在 IE8 以及 IE7 中都能实现效果。
相关文章推荐
- IE8兼容background-size:cover
- background-size: contain 与cover的区别,以及ie78的兼容写法
- 让ie8以下支持background-size的方法
- IE8兼容background-size属性
- 让IE兼容background-size的方法_background-size ie下使用
- background-size 兼容ie8
- background-size IE8兼容方案
- 同时使用background-attachment:fixed; 和 background-size:cover;时背景图大小被切割的解决方法
- background-size兼容IE8解决方案
- css背景图片填充样式background-size兼容ie8以下浏览器解决
- background-size 兼容ie8
- ie8兼容background-size
- ie8兼容background-size属性
- background-size IE8兼容方案
- 背景图片background-size兼容ie8以下浏览器解决
- IE8兼容background-size
- ie7下兼容background-size的方法
- ie6,7,8兼容background-size方法
- div+css 兼容ie6 ie7 ie8 ie9和FireFox Chrome等浏览器方法
- IE8 兼容模式 解决方法