Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2009
    Posts
    411
    Thanks
    119
    Thanked 0 Times in 0 Posts

    centering nav bar ul

    on this site I can't figure out how to get the items in the top nav bar centered in the middle of the bar.

    I added the following css but it had no effect:

    Code:
    #access {text-align:center;}
    #access .menu-header ul {text-align:center;}
    please advise. thanks.

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,749
    Thanks
    22
    Thanked 1,838 Times in 1,822 Posts
    Hello sixrfan,
    Give your ul a width and center it like this:
    To center an element you need three things:
    1. a valid DocType
    2. an element with a width
    3. that elements right/left margins set to auto



    Try this -
    Code:
    #access .menu-header ul,
    div.menu ul {
    width: 400px;
    margin: 0 auto;
    	list-style: none;
    }
    Last edited by Excavator; 12-09-2010 at 10:56 PM.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • Users who have thanked Excavator for this post:

    sixrfan (12-09-2010)

  • #3
    Regular Coder
    Join Date
    Aug 2009
    Posts
    411
    Thanks
    119
    Thanked 0 Times in 0 Posts
    i was close. thanks ex!


  •  

    Posting Permissions

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