问题
I'm just making some quick changes to the footer.
The footer needs to be sticky, i was following the method described by A List Apart method to try get the footer to stay at the bottom, but it seems to be off just a little bit.
html, body {
height: 100%;
}
#container {
position: relative;
min-height: 100%;
}
<div id="container">
<div id="content">...</div>
<div id="footer">...</div>
</div>
回答1:
I always use the CSSStickyFooter method.
HTML, a basic skeleton
<div id="wrap"> <div id="main"> </div> </div> <div id="footer"> </div>
CSS, this is only a snippet
* {margin:0;padding:0;} html, body {height: 100%;} #wrap {min-height: 100%;} #main {overflow:auto; padding-bottom: 180px;} /* must be same height as the footer */ #footer {position: relative; margin-top: -180px; /* negative value of footer height */ height: 180px; clear:both;}
回答2:
I think you should add to #wrapper clearfix, add height: 100% to #wrapper and #container in this case, you will see footer lower then should be. Now you should set top to minus height of footer and it should work. Bo I don't know if it will cover content of wrapper.
来源:https://stackoverflow.com/questions/14877482/sticky-footer-is-not-placed-at-the-bottom