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

enter image description here

you need kind of sticky footer !

demo jsfiddle

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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -