layout - CSS: best way to have dynamic height header and content area to the bottom -
i'm having header#masthead
, section#main
underneath. height of header varies, want #main
area of site fill rest of window bottom. i'd specify min-height #main
area.
is possible pure css?
or what's best way of doing that?
kind regards, sepp88
you need kind of sticky footer !
html
<div id="masthead"> <p>dynamic height</p> <div class="push"></div> </div> <div id="main"> <p>reach bottom</p> </div>
css
/* css reset */ * { margin: 0; padding: 0; } html, body { height: 100%; } #masthead { min-height: 100%; height: auto !important; /* min-height hack */ height: 100%; margin: 0 auto -21em; /* size of main */ background: red; color: white; } #main, .push { height: 21em; /* size of main */ } /* such design */ #main { background: blue; color: white; }
you can find more info min-height
hack here.
Comments
Post a Comment