开发者

Constant height div followed by div that takes up all room

Simple question, but I can't seem to find the answer.

I have a 200px vertical header (div). I want another div to go below it and take up all of the space to the bottom of the page. How do I do this?

Thanks!

EDIT: If you look at Google Calendar, this is exactly what开发者_如何转开发 I'm going for. I don't know if they use JavaScript or not, but I would rather not use it if possible.


I've created a sample file showing how to make what you ask for. The key is not to specify the height, but specify the top/bottom attachments. Summarized:

# HTML
<h1>Head</h1>
<div id="rest">...</div>

And then:

# CSS
h1 {
  position:absolute;
  top:0; height:200px;
  left:0; right:0;
}
#rest {
  position:absolute;
  top:200px; bottom:0;
  left:0; right:0;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜