Two vertical divs within a 100% height div

前端 未结 3 969
灰色年华
灰色年华 2021-01-19 17:41

Sorry for my bad english, hope you will understand my issue.

I\'m turning my head around a problem that I know I\'ve been solving once before. The issue is that I ne

3条回答
  •  深忆病人
    2021-01-19 18:18

    Use position: relative combined with position: absolute.

    Live Demo

    Get rid of these last two lines:

    div#iHeader { height:50px; background:#009900; }
    div#iWrapper  { height:100%; padding-top:-50px; padding-bottom:-150px; overflow:auto; }
    

    Replace them with:

    div#list {
        position: relative
    }
    div#iHeader {
        height:50px; background:#009900;
    
        width: 100%;
        position: absolute;
        top: 0;
        left: 0
    }
    div#iWrapper { 
        overflow:auto;
    
        width: 100%;
        position: absolute;
        top: 50px;
        left: 0;
        bottom: 0
    }
    

提交回复
热议问题