CSS对齐子菜单中心Wordpress

时间:2012-05-13 00:52:55

标签: css wordpress menu

所以基本上我需要在Wordpress中生成这样的菜单:

Needed Menu:

其中红色条是页面的宽度而不是固定的,因此可以通过调整大小来缩小。 子菜单居中

我目前有:

Current

CSS是:

#access {
    clear: both;
    display: block;
    margin: 0 auto -10px;
    width: 100%;
    text-align:center;
}
#access ul {
    font-size: 13px;
    list-style: none;
    margin: 0 0 0 -0.8125em;
    margin-top: 0.3em;
    padding-left: 0;
    display:inline-block;
    /*Font*/
    letter-spacing:1px;
    text-transform:uppercase;
    color: #FFF;
}
#access li {
    float: left;
    position: relative;
}
#access a {
    color: #eee;
    display: block;
    line-height: 2.333em;
    margin: 0 1.2125em;
    margin-bottom: 0.5em;
    padding-top: 0.5em;
    text-decoration: none;
    /* Same colour as background */
    border-bottom: 1px solid #000;
}
#access ul ul {
    display: none;
    position: inherit;
    top: 0; left: 0;
    margin: 0 auto;
    width: 100%;
    z-index: 9999;
    float: left;
}

#access ul ul a {
    color: #444;
    font-size: 13px;
    font-weight: normal;
    height: auto;
    line-height: 1.4em;
    padding: 10px 10px;
    display: inline-block;
}
#access ul ul li {
    display: inline-block;
}

任何帮助

1 个答案:

答案 0 :(得分:0)

Check this jsfiddle created for you

我在菜单代码后面定义了一个新的分区sub-menu-bg并给它一个红色背景。我也编辑了你的CSS以获得正确的水平下拉菜单。

希望这能解决您的问题。

相关问题