【发布时间】:2012-05-13 20:32:22
【问题描述】:
所以基本上我需要在 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;
}
任何帮助
【问题讨论】:
-
能否在jsfiddle.net 中创建一个示例以便更好地理解
-
创建一个 jsfiddle 或向我们提供您的网站链接。
-
嗨,谢谢@Libin 的帮助,所以我在这里创建了一个新的 JSFiddle link 我需要 ul ul 为 100% 宽度,以便它会随着页面和内部链接动态调整大小以居中,见上图。
-
@Libin 我只需要它使两个链接居中,而不是它们在左边:石店菜单的 0