Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

css footer position stick to bottom of browser?

I'm having a problem with my site http://artygirl.co.uk/pixie/about/ I can't seem to get the footer to automatically stick to the bottom of the browser, and show the rest of my background. Is there a solution better than using position:fixed or absolute?

I think there are possibly other styles over-riding some tests I do in firebug.

Thanks for your help Regards Judi

like image 601
brightmist.co.uk Avatar asked Apr 03 '10 14:04

brightmist.co.uk


2 Answers

CSS:

.podbar {
    bottom:0;
    position:fixed;
    z-index:150;
    _position:absolute;
    _top:expression(eval(document.documentElement.scrollTop+
        (document.documentElement.clientHeight-this.offsetHeight)));
    height:35px;
}

HTML:

<div class="podbar">
    Put your footer here
</div>

This will create a sticky that will always appear at the bottom of the page and overlay everything. Just add extra margin/padding to the bottom of your main container divs equal to the height of footer +5px so it doesn't overlay your content.

Works in pretty much every browser I have tested.

like image 99
Boondog Avatar answered Oct 10 '22 17:10

Boondog


I've used the technique in this article before: CSS layout: 100% height with header and footer. It does require some extra markup in your HTML.

like image 29
roryf Avatar answered Oct 10 '22 18:10

roryf