-1

I've spent an absurd amount of time on google and still cannot figure out how to center the buttons on my nav bar (I'm still new to css).

Here is what I have for the navbar (not included are my various failed attempts).

CSS:

#navigation
{
    list-style-type: none;
    background: #222222;
    overflow: hidden;
    width: 1150px;
    margin: 0;
    padding: 0;
    display:inline-block;
    margin-left: 0 auto;
    margin-right: 0 auto;
}

#navigation li
{
    border-right: solid 1px #ca0002;
    height: 35px;
    display: inline-block;
    margin: 0 auto;
}

#navigation li a:link, #navigation li a:visited
{
    text-decoration: none;  
    display: block;
    height: 35px;
    color: #fff;
    line-height: 35px;
    padding: 0 20px 0 20px;
    border-right: solid 1px #990000;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: bold;
}

#navigation li a:hover
{
    background: #990000;
    color: #fff;
}

#navigation li.first
{
    border-left: solid 1px #ca0002;
}
Community
  • 1
  • 1

1 Answers1

0

Without any html I took the liberty of creating the html and using your IDs.

Here is a working fiddle:

WORKING FIDDLE

In your navigation div I added

    height: auto; 
    text-align:center;

Some unnecessary CSS was deleted as well.

This will make the navigation tabs center in the div.

Hope this helps!

MatthewJames
  • 112
  • 1
  • 10