WordPress.org

Ready to get started?Download WordPress

Forums

horizontal navbar align right? (5 posts)

  1. Rense
    Member
    Posted 8 years ago #

    I want to make my horizontal navbar have the buttons align right instead of left. I've tried: text-align: right does nothing, putting padding in makes the bar go off the main ("wrapper") div. Also, having the navbar somehow shrinks part of the top of the masthead div.

    Here's the CSS for the navbar:

    #navlist ul
    {
    padding-left: 0;
    margin-left: 0;
    background-color: #99FF99;
    color: #567EB9;
    float: left;
    width: 100%;
    text-align: right;
    }

    #navlist ul li
    {
    display: inline;
    list-style-type: none;
    }

    #navlist ul li a
    {
    padding: 0.2em 1em;
    background-color: #99ff99;
    color: #567EB9;
    text-decoration: none;
    float: left;
    border-left: 1px solid #567EB9;
    }

    #navlist ul li a:hover
    {
    color: #99ff99;
    background-color: #567EB9;
    }

    I edited one of the listamatic navbars to my liking. Here is the site: http://hackerfoundation.org/wp

  2. petit
    Member
    Posted 8 years ago #

    I'm a little bit surprised that the #navlist ul li a are floated left, but not the #navlist ul li.
    I would have though that to be a good idea.
    Haven' tested though

  3. Rense
    Member
    Posted 8 years ago #

    I'll try that, but now that I'm working on other parts of the site I'm having trouble whenever I put a padding-left on something it shoves it past the border of the div that's containing it!

  4. petit
    Member
    Posted 8 years ago #

    There may be many causes for this behavior. If you are using fixed sizes on everything and you add extra padding somewhere, you have to compensate by changing the width ( or height of any containing box.
    A tricky part is that different browser interprets the CSS box model. Better check your design in more than one browser.
    (!!)

  5. moshu
    Member
    Posted 8 years ago #

    If everything is floated to left why do expect it to be on the right?

Topic Closed

This topic has been closed to new replies.

About this Topic