ie8无法拉伸背景图

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ie8无法拉伸背景图</title>
<style type="text/css">
body {
margin: 0;
100%;
height: 462px;
/*这么写不显示背景图在ie8下*/
/*background: url("successed.png")no-repeat;*/
/*这么写就显示背景图了在ie8下,看出区别了吗?是的就差一个空格*/
background: url("successed.png") no-repeat;
background-size: 100% 100%;
}
</style>
</head>
<body>
</body>
</html>



ie8中body的样式 在ie8下背景图无法拉伸

其他正常浏览器的样式

解决方案

1. 用img标签

img {
position: fixed;
100%;
height: 100%;
top: 0;
left: 0;
z-index: -1;
}

<img src="successed.png">
 
body{
height:1000px;
/*IE8下的背景渐变*/
filter:progid:DXImageTransform.Microsoft.Gradient(gradientType=1,startColorStr=#ffffff,endColorStr=#000000);
}

原文地址:https://www.cnblogs.com/qinmengjiao123-123/p/6762467.html