1

出于某种原因,我的 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);
}
4

1 回答 1

1

添加

#navigation {
...
margin : 0 auto;
}
于 2012-10-05T00:50:02.163 回答