How-to mix fixed and percentage heights/width using css without javascript

前端 未结 2 1311
天命终不由人
天命终不由人 2021-01-01 02:18

I want to achieve a layout like this:

 -----------------------------------------------------------
|                                                                 


        
2条回答
  •  独厮守ぢ
    2021-01-01 02:41

    See: http://jsfiddle.net/s7FH6/show/ (edit)

    HTML:

    
    

    CSS:

    html, body {
        margin: 0;
        padding: 0;
        overflow: hidden
    }
    #header {
        background: #ccc;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 150px
    }
    #content {
        background: #eee;
        position: absolute;
        left: 0;
        top: 150px;
        bottom: 0;
        width: 100%;
        overflow-y: scroll
    }
    

提交回复
热议问题