Vertically stretch div

2020-07-24 03:32发布

I have 3 div elements

< div id="header">FIXED CONTENT< /div >
< div id="content">DYNAMIC CONTENT< /div >
< div id="footer">FIXED CONTENT< /div >

How can make it so, that the header stays at top, the footer at the bottom & the content div to stretch vertically & fill the gap between header & footer. I hope the question is clear.

标签: css
1条回答
够拽才男人
2楼-- · 2020-07-24 04:08

With pure CSS:

#header {
  height: 100px;
}

#content {
  height: 100%;
  margin: 100px 0;
}

#footer {
  position: absolute;
  bottom: 0;
  height: 100px;
}
查看更多
登录 后发表回答