I am using $(".container").height($(document).height()); to set my container 100% height but I was wanting to know is there a way to adapt the above line so that it places my footer at the bottom?
I am trying to work this in with TBS
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The trick is to get the footer to stick to the bottom is creating a
.wrapperclass to contain your main content area, thus separating both main container and footer. Something like this:HTML
This way we can then use the
.wrapperclass to push the footer down however we want it too with CSS, and we do this by using the Ryan Fait Sticky Footer approach. In the case of the bootstrap, in order to to fit the top fixed navbar we have to first push the main container down instead of the body, per the bootstrap default settings. So we do this:CSS
This way we can fit the top navbar nicely in place. Afterwards we just give our footer a height and then eliminate that same width with a negative margin from the
.wrappercontainer like so:Keep in mind though that the footers height has to match exactly what you’re removing from the
.wrappercontainer, thusly if you add any extra margin or padding or a border to the footer you have to compensate with the negative margin added to the.wrappercontainer accordingly.In order to extend this approach to support the bootstrap responsive stylesheet, i have added the following media queries: (they are inline with the fixed navbar)
Here is a short demo with this approach, this method should work for both the fluid and fixed container from the bootstrap.
Demo, edit here.