Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Centering a basic ul

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #45187
    jknetdesign
    Participant

    [Your text to link here…](http://chefpepe.com/newsletters/eblast-list.html “Newsletter List”)

    What’s the most ‘pro joe’ way to center this ul horizontally and vertically on the page?

    I was hoping to avoid any widths so it’s dynamic according to whatever is the longest sentence.

    #136951
    Kitty Giraudel
    Participant

    Well, given the size of your list, I don’t think vertical centering should matter. Now, regarding horizontal centering, you won’t do much without a given width; could it be 50%, 500px or whatever pleases you.

    Try this on the #nav element:

    #nav {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    }

    And remove both z-index and height.

    #136961
    Kitty Giraudel
    Participant

    > Nice, also, if you inspect css lines 45 to 55. What would I use those spans for? I got the code from somewhere and I just want to understand better.

    Looks like you don’t use span at all, you can safely remove those lines.

    > http://stackoverflow.com/questions/7037553/center-ul-in-div-vertically-and-horizontally

    Yeah, but he’s talking about an horizontal list, not a vertical one. :)

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.