2012-05-13 101 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