解决IE8、IE7和IE6 不兼容backgroud-size

亢奇
2023-12-01

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>demo</title>
    <style type="text/css">
    /* set the background of the body */
body {
    margin: 0;
    background: url(../skin/blue/images/public/bg.png) center top no-repeat;
    -ms-behavior: url(../skin/blue/style/backgroundsize.min.htc); //-ms代表ie内核识别码
    behavior: url(../skin/blue/style/backgroundsize.min.htc);

//backgroundsize.min.htc 下载地址:https://github.com/louisremi/background-size-polyfill/blob/gh-pages/backgroundsize.min.htc
}
.bgsCover {
    background-size: cover;
}

/* this allows to use a second background in all browsers and IE8 */
body:after {
  content: "";
  background: transparent;
  position: absolute;
  z-index: -1;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}
</style>
</head>

<body class="bgsCover">
<div class="wrapper page_bg">
  
</div>
</body>

</html>

 类似资料: