CSS Submenu Align Center in WordPress

Hi I had to create a horizontal submenu for a website using wordpress. I played around with the CSS and am almost there I just need to align my links in the submenu to the centre. I tried:

text-align: center;

Read More

In the #access ul ul, But that didn’t seem to work :S

The website is: http://dev.timson.me (Submenus on “Upcoming” & “Past Productions”)

And the CSS is:

#access {
clear: both;
display: block;
float: left;
margin: 0 auto 6px;
padding-top: 8px;
width: 100%;
font-family: Stag;
display:block;
text-align:center;
}

#access ul {
    font-size: 13px;
    list-style: none;
    margin: 0 0 0 -0.8125em;
    padding-left: 0;

    display:inline-block;
}
#access li {
    float: left;
    position: relative;
}

#access a {
    color: #eee;
    display: block;
    line-height: 25px;
    margin-top: -4px;
    margin-bottom: -4px;
    padding: 0 1.2125em;
    text-decoration: none;
}

#access ul ul {

    display: none;
    float: left;
    margin-top: 0;
    position: fixed;
    top: 264px;
    left: 50%;
    width: 1000px;
    z-index: 99999;
    margin-left:-500px;
    text-align:center;
    padding-top:5px;
    padding-bottom:10px;

    background: red;
}

#access ul ul a {

    margin-top: 0px;
    margin-right: auto;
    margin-bottom: 0px;
    margin-left: auto;
    padding-bottom:10px;

}

#access ul li:hover > ul {
    display: block;
}

Any help is greatly appreciated cheers.

Peter

Related posts

Leave a Reply

1 comment

  1. First, add this rule

    .sub-menu {
        text-align: center;
    }
    

    Second, change

    #access li {
        float: left;
        position: relative;
    }
    

    to

    #menu-default > li {
        float: left;
        position: relative;
    }
    

    And third, add this rule

    .sub-menu > li {
        display: inline-block;
    }