2014-07-08 60 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