Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

floating footer always on the bottom and visible

I have a website like this one: >> website <<. It is built from 2 frames - main and a footer. I was trying to get it working without frames (don't work on mobile phones). Is there any simple CSS or jQuery method to stick the footer on the bottom to be visible always? so the effect is like on the website above? I was trying to use css, but the footer appears only when I scroll down to it. I want the footer to cover the actual content, so it's always for example 50pixels high and is always visible on the bottom of the screen. even if the page is 10000px high. I believe it's something simple, but I got lost somewhere there. Thank you for your help in advance

like image 376
Piotr Ciszewski Avatar asked Nov 28 '12 15:11

Piotr Ciszewski


People also ask

How do you always keep the footer at the bottom of a page?

html. < div id = "footer" >This is a footer. This stays at the bottom of the page.

Why the footer is not coming at the bottom of the?

However, if the page has a short amount of content on it, a statically positioned footer may not render at the bottom of the user's browser window. A sticky footer will guarantee that it is always placed at the bottom of the browser window AND after all the content, regardless of the length of content on the page.

Why is my footer in the middle of my page?

When the footer margins are too narrow or the padding is too wide, the footer position shifts and can move to the middle of the Web page. One easy solution is to remove the margins and padding entirely, so that those footer properties correspond to the rest of the coding.

How do you set the footer at the bottom of the page in bootstrap?

In order for this element position at the bottom of the page, you have to add fixed-bottom to the class footer .


2 Answers

Yes. It's the position: fixed property.

.footer {     position: fixed;      bottom: 0;     left: 0;     right: 0;     height: 50px; } 

Demo: http://jsfiddle.net/ZsnuZ/

like image 175
Christian Avatar answered Nov 05 '22 00:11

Christian


(function() {     $('.footer').css('position', $(document).height() > $(window).height() ? "inherit" : "fixed"); })(); 
like image 29
Sam Jones Avatar answered Nov 05 '22 00:11

Sam Jones