WordPress.org

Ready to get started?Download WordPress

Forums

How do I center my navigation bar? (4 posts)

  1. ericbowers
    Member
    Posted 6 years ago #

    I've been trying to do this on my own but have had no success. I want to simply center my site's navigation bar, not have it aligned left or right. I need it center aligned and horizontal. Any tips? Below is my CSS code for the navbar - what should I change?

    /*
    navigation
    ---------------------------------------------- */
    
    ul#nav {
    float: right;
    font-size: 0.9em;
    text-align: right;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    
    }
    #nav li {
    float: left;
    list-style-type: none;
    display: block;
    margin-left: 10px;
    }
    #nav li a {
    float: left;
    height: 100%;
    display: block;
    padding: 30px 5px 0;
    }
    #nav li a:hover,
    body#home li#nav-home a,
    body#archives li#nav-archives a,
    body#contact li#nav-contact a,
    body#about li#nav-about a {
    background: #f9f9f9;
    }
  2. Michael Torbert
    WordPress Virtuoso
    Posted 6 years ago #

    Is http://www.madnessmatrix.com the site? Maybe I'm missing something, but on a quick glance it looks like the nav bar is in the middle.

  3. ericbowers
    Member
    Posted 6 years ago #

    Yes, that is the site. Awhile after posting this thread, I added

    width: 62em;

    to my ul#nav, which seems to have centered it. Though I'll have to change it each time I add or remove a link in the navbar it looks like.

    Thanks for responding!

    -Eric

  4. Michael Torbert
    WordPress Virtuoso
    Posted 6 years ago #

    No problem. Let me know if I can help you.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.