Brett Glogoski
Brett Glogoski

Reputation: 15

Fixed centered sticky footer can't position in center.. Ideas please

I have a 600px wide footer graphic that I want to be positioned in the center of the page. I currently have it fixed at the bottom of the browser, which is what I want - I want the content to scroll from underneath the footer, if you know what I mean. With the fixed value my footer hangs on the left. With a value of relative, its centered, but stuck to the bottom of the page, and I end up having a load of blank white space to scroll down until I see the footer. Infact, removing the whole position: property has the same effect as the relative value.

How can I fix this?

I attempted ideas here - How to horizontally center a <div> in another <div>? but none of them worked =[

CSS

#footer {
position: fixed;
margin-top: -110px; 
height: 110px;
width: 600px;
margin: 0 auto;
clear:both;
bottom: 0;

}

Upvotes: 0

Views: 2160

Answers (2)

jhunlio
jhunlio

Reputation: 2660

html:

<div class="footerWrap">
  <div class="footer"></div>
</div>

css:

.footerWrap {
    width:100%;
    position:fixed;
    bottom:0;
}
.footer {
    margin:auto;
    width:600px;
    height:110px;
}

working demo

hope this help

Upvotes: 2

baqtiste
baqtiste

Reputation: 78

Try this

html, body, and other div relative {
   width: 100%;
}


#footer {
    position: fixed;
    margin-top: -110px; 
    height: 110px;
    width: 600px;
    clear:both;
    bottom: 0;
    left: 50%;
    margin-left: -300px; /* half size of footer */
}

Upvotes: 0

Related Questions