2012-12-08 70 views
2

如何让twitter bootstrap导航栏固定宽度,同时保持居中?如何让twitter bootstrap navbar固定宽度?

我试着在.navbar中添加宽度参数,但导航栏未对齐。

.navbar { 
overflow: visible; 
margin-bottom: 20px; 
color: #956362; 
*position: relative; 
*z-index: 2; 
width: 650px; 
} 

我也试过

<div class="span6 offset3"> 

,但这也使得它对齐。

回答

4

用div围绕它。 给这个div一个固定的宽度。

喜欢的东西:

<div class="navbar-outer"> 
    <div class="navbar"> 
    <!--here goes the rest of the code--> 
    </div> 
</div> 

CSS:

.navbar-outer { 
    width:500px; 
} 
+0

谢谢!还增加了余量:自动和保证金 - 右:自动,并得到它的工作! –