How to make div occupy remaining height?

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

I have this problem, I have two divs:

<
11条回答
  •  情书的邮戳
    2020-11-27 13:12

    You could use calc function to calculate remaining height for 2nd div.

    *{
      box-sizing: border-box;
    }
    
    #div1{
      height: 50px;
      background: skyblue;
    }
    
    #div2{
      height: calc(100vh - 50px);
      background: blue;
    }

提交回复
热议问题