You can 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 properties of the top, right, bottom and left, you get a div that occupies the entire viewport.
Then you set padding-top to #content as> = height #header .
Finally, put #header inside #content and set it absolutely (specifying top, left, right and height).
I'm not sure how convenient this is for the browser. Check out this article at List Apart for more info.
Bryan Downing May 24 '10 at 19:25 2010-05-24 19:25
source share