Make div take up rest of space (height)?

This question already has an answer here:

  • Make a div fill the height of the remaining screen space 31 answers

  • 如果我正确理解你的问题,那么我认为这将做你想要的:

    container > .body
    {
        height: 100%;
        max-height:100%;
        overflow: auto;
        background: lightgrey;
    }
    

    试试这个..希望这有助于

       .container
    {
        height: 300px;
        border: black 1px solid;
        background: #D3D3D3;
    }
    
    .container > .header
    {
        height:auto;
        background: grey;
        max-height: 200px;
        overflow: auto; 
    }
    .container > .header > span
    {
        display: inline-block;
        padding: 10px;
    }
    .container > .header > .active
    {
        background: black;
        color: white;
    }
    
    .container > .body
    {
        height: auto;
        max-height: 100px;
        overflow: auto;
        background: lightgrey;
    }
    
    链接地址: http://www.djcxy.com/p/88232.html

    上一篇: Div 100%页面响应高度

    下一篇: 让div占用其余的空间(高度)?