水平CSS UL菜单

时间:2012-10-05 00:45:23

标签: css

出于某种原因,我的CSS样式的UL菜单不会水平居中。创建它的CSS是:

#navigation {
    width:79em;
    height: 2em;
    position: relative;
    padding: .5em;
    font-family: Verdana, Geneva, sans-serif;
    text-transform: uppercase;
    font-size: 1em;
    background-color: #F5F5F5;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    border-radius: 3px;
    -webkit-box-shadow: 0 0 1em 0 #333;
    -moz-box-shadow: 0 0 1em 0 #333;
    box-shadow: 0 .25em .3em -.055em #333;
}

#navigation ul {
    text-align: center;
    padding: 0;
    margin: 0;
    list-style: none;
}

#navigation li {
    display: inline;
    list-style: none;
    display: block;
    float: left;
    width: 10em;
    height: 2em;
    text-align: center;
    padding: .5em 0 0 0;
    margin: 0;
    border-left: .0625em solid #FFF;
    border-right: .1em solid #CCC;
    text-shadow: .0625em .0625em .0625em #ffffff;
    filter: dropshadow(color=#ffffff, offx=1, offy=1);
}

1 个答案:

答案 0 :(得分:1)

添加

#navigation {
...
margin : 0 auto;
}