头尾固定中间高度自适应布局 css

<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE html>
<html>
<head>
<meta charset="gb2312">
<title>头尾固定中间高度自适应布局</title>
<style>
html,body{height:100%;}
body {
    margin:0;
    overflow:hidden;
}
#dHead {
    height:100px;
    line-height:100px;
    background:#690;
    width:100%;
    position:absolute;
    z-index:5;
    top:0;
    text-align:center;
}
#dBody {
    background:#FC0;
    width:100%;
    position:absolute;
    z-index:100;
    top:100px;
    bottom:100px;
    overflow:auto;
}
.mycontent {
    padding:20px;
}
#dFoot {
    height:100px;
    line-height:100px;
    background:#690;
    width:100%;
    position:absolute;
    z-index:200;
    bottom:0;
    text-align:center;
}
</style>
</head>

<body>
<div id="dHead"></div>
<div id="dBody">
 
</div>
<div id="dFoot"></div>
</body>
</html>

 

效果:

 

posted @ 2017-11-28 21:44  老板、番茄炒蛋  阅读(305)  评论(0编辑  收藏  举报