How can an html element fill out 100% of the remaining screen height, using css only?

后端 未结 17 1871
名媛妹妹
名媛妹妹 2020-12-22 16:13

I have a header element and a content element:

#header
#content

I want the header to be of fixed height and the content to fill up all the

17条回答
  •  佛祖请我去吃肉
    2020-12-22 17:02

    With HTML5 you can do this:

    CSS:

    body, html{ width:100%; height:100%; padding: 0; margin: 0;}
    header{ width:100%; height: 70px; }
    section{ width: 100%; height: calc(100% - 70px);}
    

    HTML:

    blabablalba
    Content

提交回复
热议问题