2014-03-28 119 views
0

我已经想出了如何将徽标居中,但无法将导航集中到中心位置。希望你们可以帮忙!中心菜单导航

代码为中心的标志:

#header #logo{ 
float: none !important; 
} 

#header hgroup { 
float: none !important; 
text-align: center !important; 
} 

我知道这是非常基本的,但我喜欢一些帮助。谢谢。看我的网站here

+0

它应该是作为左,右页边距设置为自动导航元素,或设置文本对齐到中心,并确保儿童项目未漂一样简单,但不幸的是你的CSS似乎是一个有点噩梦来调试。 – John

回答

1

这应做到:

#navigation{ 
    float:none; 
    text-align:center; 
} 

#navigation > ul{ 
    float:none !important; 
    display:inline-block; 
} 
0

您可以在<nav>标签和display: inline-block<ul>使用text-align: center

您还需要从#header #navigation#header #navigation ul.nav删除float: right

你也不需要#header #navigation,因为ID是独特的#navigation应该是足够的。

#navigation { 
    float: none; 
    text-align: center; 
} 


#navigation ul.nav { 
    display: inline-block;  
    float: none; 
}