html - Footer sticky at bottom, content-wrapper fill free space -


i'm working on web layout:

  1. header , footer should full-width, content narrow , centered
  2. footer @ bottom of screen or @ bottom of page, depending on content length
  3. if content not fill complete screen, wrapper should fill screen anyway

layout described above

the first 2 points no problem, can stretch body using javascript. css min-height: 100% not work, there possibility fix in pure css?

here's a fiddle of scenario including quick-and-dirty jquery solution.

this css.nothing change...just few edit..

remove min-height,instead height,and id of section give height:100%

html, body {     margin: 0px;     padding: 0px;     height: 100%; } #layout-helper-wrapper { height: 100%;     position: relative;     margin: 0px auto;     background-color: #eee;     overflow: hidden; }  header, footer {     background-color: #fb2;     margin: 0px;     z-index: 2;     width: 100%;     position: absolute; } header {     height: 30px; } footer {     height: 20px;     bottom: 0; }  #body-wrapper {     width: 500px;     margin: 0px auto;     background-color: #fff;     position: relative;     box-shadow: 0px 0px 8px 3px #aaa;     padding: 30px 20px 20px;     overflow: hidden;     height:100%; } 

http://jsfiddle.net/aj9hr/11/


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 -