You could use absolute positioning.
HTML
<div id="content">
<div id="header">
Header
</div>
This is where the content starts.
</div>
CSS
BODY
{
margin: 0;
padding: 0;
}
#content
{
border: 3px solid #971111;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: #DDD;
padding-top: 85px;
}
#header
{
border: 2px solid #279895;
background-color: #FFF;
height: 75px;
position: absolute;
top: 0;
left: 0;
right: 0;
}
By positioning #content
absolutely and specifying the top, right, bottom, and left properties, you get a div taking up the entire viewport.
Then you set padding-top
on #content
to be >= the height of #header
.
Finally, place #header
inside #content
and position it absolutely (specifying top, left, right, and the height).
I'm not sure how browser friendly this is. Check out this article at A List Apart for more information.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…