2013-04-23 75 views
0

給定一個由HTML標籤UL和LI的Wordpress主題「Twenty Eleven」創建的菜單,我們如何去關注LI項目的居中。當顯示器變窄並且菜單消耗兩行時,客戶希望將各個項目居中。用UL,LI呈現的居中菜單

enter image description here

單行菜單

enter image description here

分割線菜單,尚未中心

enter image description here

的CSS #access UL

#access ul { 
    font-size: 13px; 
    list-style: none outside none; 
    margin: 0px 0px 0px -0.8125em; 
    padding-left: 0px; 
} 

的CSS李

#access li { 
    float: left; 
    position: relative; 
} 

回答

0
  1. #access ul

  2. 開關float: left;添加text-align: center;width: 100%;display: inline;#access li。您可能需要固定襯墊,寬度或高度以便更好地觀看。

+0

如果display:inline無法實現,請嘗試使用inline-block。裏面的任何元素都需要一個display:block(我想你會用元素) – 2013-04-23 19:09:46