html - Footer sticky at bottom, content-wrapper fill free space -
i'm working on web layout:
- header , footer should full-width, content narrow , centered
- footer @ bottom of screen or @ bottom of page, depending on content length
- if content not fill complete screen, wrapper should fill screen anyway
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%; }
Comments
Post a Comment