How to make div occupy remaining height?

前端 未结 11 1066
遇见更好的自我
遇见更好的自我 2020-11-27 12:49

I have this problem, I have two divs:

<
11条回答
  •  -上瘾入骨i
    2020-11-27 13:34

    You can use this http://jsfiddle.net/Victornpb/S8g4E/783/

    #container {
        display: table;
        width: 400px;
        height: 400px;
    }
    #container > div{
        display: table-row;
        height: 0;
    }
    #container > div.fill{
        height: auto;
    }
    

    Just apply the class .fill to any of the children to make then occupy the remaining height.

    Lorem ipsum
    Lorem ipsum
    Lorem ipsum

    It works with how many children you want, no additional markup is required.

提交回复
热议问题