I have HTML5boilerplate and I want to make a template with sticky footer and image as background of body. The background should be always at the end of the page (if page is higher than clientHeight) or at the screen (if page is shorter).
My problem is when sticky footer works but background doesn't and vice versa.
Take a look, please.
This is my index.html:
<body>
<div class="wrap">
<header></header>
<div class="main clearfix right-sidebar">
<div class="content"></div>
<div class="sidebar"></div>
</div>
</div> <!-- end of .wrap -->
<footer></footer>
</body>
My CSS is:
/*html, body { min-height: 100%;}*/
html, body { height: 100%;}
body > .wrap {height: auto; min-height: 100%; margin: 0 auto;}
body > .wrap > .main { padding-bottom: 70px;}
body > .wrap, body > footer {width: 950px; position: relative;}
body > footer { margin: -70px auto 0 auto ; height: 70px; clear:both; }
</* end of centered sticky footer */
body { background: url(../img/bg.png) #fff 0% 100% repeat-x; }
.clearfix:before, .clearfix:after { content: " "; display: table;}
.clearfix:after { clear: both; }
.clearfix { *zoom: 1; }
When I define html, body { height: 100%;}
everything is ok, if page is shorter than client's screen.
When the page is higher than client's screen background-image is at the bottom of the screen - not the page. When user srcolls the page the image is in the middle of the screen.
This picture shows the problem (yellow background for your convience):
And when when I define html, body { min-height: 100%;}
everything is ok on high pages, but sticky footer doesn't work on shorter ones:
I'd like to add that I don't want to fixed background. It should be at the of the screen or page.