views:

199

answers:

5

I have the following unordered list within a div:

<div id="footer">
 <ul>
  <li>Blog</li>
  <li>|</li> 
  <li>About Us</li> 
  <li>|</li> 
  <li>Privacy Policy</li> 
  <li>|</li> 
  <li>Copyright</li> 
  <li>|</li> 
  <li>Contact Us</li> 
  <li>|</li> 
  <li>Press Inquiries</li>
 </ul>
</div>

I want this footer text to stay centered in the screen no matter the width of the window. How would I do this using CSS??

+8  A: 
#footer{
   text-align:center; 
}
Vincent Ramdhanie
Assuming that the list items have been edited to display: inline - which the OP didn't mention.
David Dorward
margion: 0 auto;width: 50%; #change to suitable valueis better
dusoft
A: 

Either

#footer_list {text-align:center;}

or

#footer_list {width:500px; margin:0 auto;}
Emily
A: 

This tutorial describes, in part, how to do this.

graham.reeds
A: 

It's possible to center a floated list by using relative positioning too.

Matthew James Taylor
A: 

Does this work?

ul {
    padding:0;
    margin:0;
}
li {
    width: 300px;
    margin: auto;
}
sakabako