2012-05-13 104 views
0

所以基本上我需要制作一个这样的菜单中的WordPress:CSS对齐子菜单中心的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; 
} 

任何帮助

+0

您可以在http://jsfiddle.net中创建一个示例以便更好地理解 – sandeep

+0

创建一个jsfiddle或为我们提供您的网站链接。 – Libin

+0

嗨感谢您的帮助@Libin,所以我在这里创建了一个新的JSFiddle [链接](http://jsfiddle.net/ptimson/v4Ydu/)我需要ul ul是100%的宽度,所以它会动态调整页面大小和中心内的链接,请参阅上面的图片。 – ptimson

回答

0

Check this jsfiddle created for you

我已经定义的新在菜单代码后给出一个红色背景sub-menu-bg。另外我编辑了你的CSS来实现正确的水平下拉菜单。

希望这会解决您的问题。

+0

我已经更新了我的jsfiddle。请检查答案中给出的链接。 – Libin