Reputation: 1434
please see this site in firefox:
http://www.imageworkz.asia/microtel
the footer does not stick at the bottom of the page like how it is with stackoverflow's footer. I tried several techniques as shown in some reference sites but still, no luck.
I need some css experts out there to help me out with this. Thank you!
Upvotes: 0
Views: 221
Reputation: 826
<script type="text/javascript">
$(document).ready(function() {
var docHeight = $(window).height();
var footerHeight = $('#footer').height();
var footerTop = $('#footer').position().top + footerHeight;
if (footerTop < docHeight) {
$('#footer').css('margin-top', 10 + (docHeight - footerTop) + 'px');
}
});
</script>
Upvotes: 0
Reputation: 909
There are mare ways to make sticky footers. A basic trick for a footer with fixed height
html, body {
height: 100%;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -150px; /* the bottom margin is the negative value of the footer's height */
}
.footer {
height: 150px; /* .push must be the same height as .footer */
}
or
you can check this post (and many others) with the title "sticky footer"
Upvotes: 3
Reputation: 27765
Make it fixed position with bottom 0
value:
footer {
position: fixed;
bottom: 0;
}
Upvotes: 0
Reputation: 1008
add position:fixed; bottom:0; left:0
to footer and it will fix it in place. If you then add #container {padding-bottom:120px}
(or something around that amount) your content won't be hidden by the footer when viewing the bottom of the page
Upvotes: 1