2013-04-23 66 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