Reputation: 111
I'm having problems getting my footer to stick to the bottom of the page when there are position absolute elements in the main container. Here's a fiddle to demonstrate.
<div class="content-wraper">
<div class="side-nav"></div>
</div>
<div class="footer"></div>
.content-wraper {
background-color:blue;
min-height:100px;
position:relative;
width:500px;
}
.side-nav {
background-color:red;
height:3000px;
position:absolute;
top:0px;
left:0px;
width:200px;
}
.footer {
background-color:black;
position:absolute;
bottom:0px;
width:200px;
height:50px;
}
Upvotes: 0
Views: 756
Reputation: 337560
Change position: absolute;
in .footer
to position: fixed;
UPDATE
To fix the footer to always be below the absolutely positioned side-nav
using jQuery try this:
$(".footer").css("top", $(".side-nav").height());
Upvotes: 5
Reputation: 2636
absolute positioning refers to window size, not content size, so if content is higher than window, you won't get the effect you want.
Try different approach:
Upvotes: 1