Not signed in (Sign In)

SkillShare - A place to discuss Web Standards and Web Design topics

Categories

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

  1.  permalink
    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.
    •  
      CommentAuthormringlein
    • CommentTimeJun 4th 2006
     permalink
    I will just say I was struggling with a similar problem on
    http://marthastable.marylandmedia.com

    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.
    • CommentAuthoraspiramedia
    • CommentTimeJun 7th 2006 edited
     permalink
    Would you be able to add

    margin: 0 auto;

    to your list? And wrap a div around with text-align center for IE?

    Hope this helps. If this doesn't sove it try using display:inline for your li tags - that way no floats are used.
    •  
      CommentAuthormringlein
    • CommentTimeJun 7th 2006
     permalink
    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.
    •  
      CommentAuthorJohnRiv
    • CommentTimeJun 7th 2006 edited
     permalink
    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:

    http://24ways.org/advent/centered-tabs-with-css

    http://www.cssplay.co.uk/menus/centered2.html

    Neither of them work in the latest IE7 though, although the 24ways method doesn't break as bad as the cssplay method
  2.  permalink
    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.
Add your comments
    Username Password
  • Format comments as (Help)