2014-07-08 131 views
1

我正在創建基於Twenty Eleven主題的Wordpress主題,無法弄清楚如何自動導航欄中心,因此我不必經常更新它。我如何使水平導航菜單中心對齊

這裏是我的CSS: http://pastebin.com/SGvKmXEb

這裏是PHP/HTML: http://pastebin.com/TBL1nzjV

有可能是在CSS重複的屬性,但僅僅是因爲我仍然在這個試驗和測試多個事...

在此先感謝您的幫助!

+2

請編輯您的問題,包括CSS和標記所使用。如果您的鏈接或鏈接上的內容在未來發生變化,那麼此問題仍將提供幫助其他用戶找到解決類似問題所需的所有信息。 –

+1

好的,會做的!謝謝! – user3634781

回答

0

這個工作對我的測試網站,你提供

#access li { 

float: left; /*delete*/ 
display:block; /*delete*/ 

display:inline-block; /*add*/ 

} 

#access ul { 

margin-left: 25%; /*delete*/ 
margin-right: 25%; /*delete*/ 
width: 1000px; /*delete*/ 
height: 10px; /*delete*/ 

margin-bottom: 0px; /*add*/ 
margin-left: 0px; /*add*/ 
padding: 0px; /*add*/ 

} 
+0

謝謝!這工作完美! – user3634781

0

我會選擇一種內聯塊方法。

.containerElement { 
    width: 100%; 
    text-align: center; 
} 

.childElements { 
    display: inline-block; 
} 

爲了讓它在你的代碼工作,你需要刪除.containerElement(#access UL)固定高度,.childElements(#access LI)漂浮性。

+0

我已經試過這個,沒有什麼不同 - 這裏是它的樣子的示例:http://yenrac.net – user3634781