为什么设置background-size就不一样了?
还有container高度设置了太高了,会有很多的留白,该怎么处理?把height等于4000改成100%为什么不行
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
html,body{
margin:0;
padding:0;
}
.container{
width:100%;
height:4000px;
background:url("http://img1.sycdn.imooc.com/climg//59c9f7ce0001839219034033.png") no-repeat center top;
background-size:100%;//设置了
}
.left{
width:200px;
height:400px;
background:url("http://img1.sycdn.imooc.com/climg//5a3383c70001f1b702240364.png") no-repeat center top;
position:fixed;
left:0;
top:50%;
margin-top:-200px;
background-size:100%;//设置了
}
.right{
width:200px;
height:400px;
background:url("http://img1.sycdn.imooc.com/climg//5a3383d00001a3dd02240364.png") no-repeat center top;
position:fixed;
right:0;
top:50%;
margin-top:-200px;//没有
}
</style>
</head>
<body>
<div class="container">
<div class="left"></div>
<div class="right"></div>
</div>
</body>
</html>
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧