background-size兼容IE8解决方案

1、通过滤镜的方法 

body {
    background: url() no-repeat center;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    filter: progid: DXImageTransform.Microsoft.AlphaImageLoader( src='', sizingMethod='scale');
    -ms-filter: progid: DXImageTransform.Microsoft.AlphaImageLoader( src='', sizingMethod='scale');
}

2、通过htc文件(通过计算屏幕尺寸控制img标签尺寸,模拟background-size:cover;效果

you can use this file (https://github.com/louisremi/background-size-polyfill “background-size polyfill”) for IE8 that is really simple to use:

.selector {
background-size: cover;
-ms-behavior: url(/backgroundsize.min.htc);
}

3、根据2的原理写js进行控制


你可能感兴趣的:(兼容性问题)