顶部和底部固定高度,中间高度自适应的布局

html代码

<div id="all">
        <div id="top">topdiv>
        <div id="content">div>
        <div id="bottom">bottomdiv>   
div>

css代码

*{
   margin:0;
    padding:0;
 }
#top{
    position:absolute;
    top:0;
    left:0;
    background-color:#05C020;
    height:50px;
    width:100%;
    z-index:100;
}
#bottom{
    position:absolute;
    bottom:0;
    left:0;
    background-color:#88D6E9;
    height:50px;
    width:100%;
    z-index:100;
}

#middle{
    position:absolute;
    width:100%;
    overflow:auto;
    background-color:#F0E6A2;
    bottom:50px;
    top:50px;
    /* height:100%;
    border-top:50px solid #eee;
    border-bottom:50px solid #eee;
    top:0px; */
    z-index:90;
}

实现效果,中间黄色的部分可以根据浏览器的高度大小进行高度自适应
顶部和底部固定高度,中间高度自适应的布局_第1张图片

你可能感兴趣的:(css,顶部和底部固定,高度自适应)