DIV 100% 自适应高度 不出现滚动条
April 18, 2008 | tags 网页设计 | views
Comments 0
这也是突然发现的。为什么 在html中设置 padding-top:100就有效果呢?希望有人给于解答。北京网站建设
以下是代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Qhis 2008</title>
<style type="text/css">
* {
padding: 0px;
margin: 0px;
}
html,body{
background:#FFFFFF;
height: 100%;
width: 100%;
}
html{
padding-top: 77px;
}
#E1{
position: absolute;
width: 100%;
height: 57px;
background: Aqua;
z-index: 1;
top: 0px;
}
#E2{
position: absolute;
width: 100%;
height: 20px;
background: Blue;
z-index: 1;
top: 57px;
}
#E3{
width: 100%;
height:100%;
background: #ff0;
}
</style>
</head>
<body>
<div id="E1"></div>
<div id="E2"></div>
<div id="E3">sddsfsdff</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Qhis 2008</title>
<style type="text/css">
* {
padding: 0px;
margin: 0px;
}
html,body{
background:#FFFFFF;
height: 100%;
width: 100%;
}
html{
padding-top: 77px;
}
#E1{
position: absolute;
width: 100%;
height: 57px;
background: Aqua;
z-index: 1;
top: 0px;
}
#E2{
position: absolute;
width: 100%;
height: 20px;
background: Blue;
z-index: 1;
top: 57px;
}
#E3{
width: 100%;
height:100%;
background: #ff0;
}
</style>
</head>
<body>
<div id="E1"></div>
<div id="E2"></div>
<div id="E3">sddsfsdff</div>
</body>
</html>
本文出自 “有个blog” 博客,请务必保留此出处http://oyoyo.blog.51cto.com/150487/71899