...

View Full Version : Footer isn't centered



Citrusgirl
11-20-2010, 05:44 PM
At the bottom of the website it appears as if the footer isn't centering.


http://www.organicgardencafe.com/index.php



This is the css for the footer.

#footer{
text-align:center;
height:30px;
width:980px;

}



Probably a simple fix, but I can't catch it.

Excavator
11-20-2010, 05:59 PM
To center an element you need three things:

a valid DocType
an element with a width
that elements left/right margins set to auto

Try making your CSS look like this -
#footer {
text-align:center;
height:30px;
width:980px;
margin: 0 auto;
background: #ff0; /*just for demonstration*/
}

Citrusgirl
11-20-2010, 06:48 PM
Thank you. I just had to add and the footer centers perfectly now.
margin: 0 auto;

Excavator
11-20-2010, 06:54 PM
Very cool. Looks much better.
Is that your site? It's interesting, I sent it to my sister who is a vegetarian.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum