I need some help on centering navigation. I'm developing a template in WordPress that uses the pages function to add new pages into a horizontal navigation bar (unordered list). I understand how to make it align left or right using floats, but what about centering it? What I would ultimately like to have is a nav that expands each button to take up whatever horizontal space is available within it's parent <div>. I also want it to shrink to accept more buttons as they are added through the WordPress admin without having to go back and adjust the padding. This is exactly how I used to use tables. Is there some way of replicating this without the use of tables? I've tried to pad the <li> elements with percentages rather than pixels but this doesn't seem to have any effect. Anyone have some advice or a site that I could look at that does something similar.
Notice the footer links at the bottom. I couldn't get that UL to center; so I just said screw it and gave it a left-margin to give the illusion of being centered.
Auto margin and center text-align didnt work well for me. One of my (and perhaps others) issues with making the LI tag inline is that I need to do block-level things with my LI tags at time as well as my LI A tags. I could wrap my links in an LI DIV A, but that is just as messy as what I am doing now.
If you can set a width other than auto on your UL, then adding margin: 0 auto; will work. If the width of the UL is variable, then there's a few ways to center its content:
Thanks for all the help. It seems that there is just no easy way of getting what I'm looking for. I had looked at CSSPlay's demos and have been trying to take them apart to get what I need but no such luck yet. I post what I come up with.