CSS对齐子菜单中心Wordpress

CSS对齐子菜单中心Wordpress,css,wordpress,menu,Css,Wordpress,Menu,所以基本上我需要在Wordpress中生成这样的菜单: 其中,红色条是页面的宽度,不固定,因此可以通过调整大小进行收缩。 并且子菜单居中 我目前有: CSS是: #access { clear: both; display: block; margin: 0 auto -10px; width: 100%; text-align:center; } #access ul { font-size: 13px; list-style: no

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

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

我目前有:

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;
}
有什么帮助吗

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


希望这能解决你的问题

您能否在中创建一个示例以便更好地理解创建一个JSFIDLE或向我们提供您的网站链接。您好,谢谢您的帮助@Libin,因此我在这里创建了一个新的JSFIDLE,我需要ul ul为100%宽度,以便它能够随页面动态调整大小,并且内部链接居中,请参见上图。@Libin我只需要它将两个链接居中,而不是将它们放在左侧:Stone Shop menuI的0已更新了我的JSFIDLE。请检查答案中给出的链接。