How to fill 100% of remaining height?

后端 未结 8 1069
眼角桃花
眼角桃花 2020-12-04 11:25
+--------------------+
|                    |
|                    |
|                    |
|                    |
|         1          |
|                    |
|            


        
8条回答
  •  感动是毒
    2020-12-04 11:44

    I know this is an old question, but nowadays there is a super easy form to do that, which is CCS Grid, so let me put the divs as example:

    Contents of 2

    then the CSS code:

    .full{
      width:/*the width you need*/;
      height:/*the height you need*/;
      display:grid;
      grid-template-rows: minmax(100px,auto) 1fr;
     }
    

    And that's it, the second row, scilicet, the someide, will take the rest of the height because of the property 1fr, and the first div will have a min of 100px and a max of whatever it requires.

    I must say CSS has advanced a lot to make easier programmers lives.

提交回复
热议问题