关于页面高度问题
老师您好,在.con的css样式中设置height:4000px之后,即使设置了HTML和body宽高为100%,运行页面依旧会出现上下滚动条,是为什么呢?
具体代码如下:
<!DOCTYPE html>
<html>
<head>
<title>sticky</title>
<style type="text/css">
*{
margin:0px;
padding:0px;
}
html, body{
width:100%;
height:100%;
}
.con{
width:100%;
height:100%;
background:url("images/mooc.png") center top no-repeat;
}
.opacity_{
width:100%;
height:100%;
background:url("images/opacity.png");
position:fixed;
top:0px;
left:0px;
}
.login{
width:360px;
height:360px;
background:url("images/login.png")no-repeat;
position:fixed;
top:50%;
left:50%;
margin-top:-180px;
margin-left:-180px;
}
</style>
</head>
<body>
<div class="con"></div>
<div class="opacity_"></div>
<div class="login"></div>
</body>
</html>
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星