www.webdeveloper.com
Results 1 to 3 of 3

Thread: dumb <ul> question

  1. #1
    Join Date
    Oct 2011
    Location
    Hamilton, Ontario
    Posts
    84

    dumb <ul> question

    I said 'dumb' because I feel like I should know this with all the experience I've had with HTML5... i'm probably just missing something really stupid... but here's the code, I've having trouble centering the <ul>:

    CSS:
    #nav {background-color: #804000; float: left; padding: 5px; margin:2px;}

    HTML:
    <ul style="list-style:none;" align="center">
    <li id="nav" onclick="hide('ma')">MIDDLE AGES</li>
    <li id="nav" onclick="hide('rn')">RENNAISSANCE</li>
    <li id="nav" onclick="hide('bb')">BAROQUE</li>
    <li id="nav" onclick="hide('cc')">CLASSICAL</li>
    <li id="nav" onclick="hide('rr')">ROMANTIC</li>
    <li id="nav" onclick="hide('me')">MODERN EUROPE</li>
    <li id="nav" onclick="hide('mna')">MODERN NORTH AMERICA</li></ul>

    I've also tried other things, like <center>, style="text-align: center;" and more

  2. #2
    Join Date
    Jul 2012
    Posts
    57
    what I do is center with margins in css. Likewise

    #container {
    margin-left:auto;
    margin-right:auto;
    width:9999999999999999999px;
    }

    #nav {
    //style stuff here
    }

    .. Then do this:

    <div id="container"><div id="nav">ul stuff here </div></div>

  3. #3
    Join Date
    Mar 2011
    Posts
    1,148
    The code in your first message doesn't match the code in your second message, so it's hard to know which version you want fixed. It's also difficult to understand what you want centered: is it the<ul> list as a block, or do you just want to center the text contained in the individual <li> elements?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles