css - 如何使 twitter bootstrap 导航栏固定宽度?

标签 css twitter-bootstrap css-float

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

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

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

我也尝试过

<div class="span6 offset3">

但这也会导致其错位。

最佳答案

用 div 包围它。 给该 div 一个固定的宽度。

类似于:

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

CSS:

.navbar-outer {
  width:500px;
}

关于css - 如何使 twitter bootstrap 导航栏固定宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13780471/

相关文章:

css - 如何强制扩展弹出窗口为 X 宽度?

html - 将 css 属性的值设置为 html 属性的值

html - Bootstrap 3 col-sm-4 创建两列而不是 3

html - 如何在 Bootstrap 中添加单选按钮和提交按钮之间的间距?

html - 无法在父级中垂直对齐并排的子 div

jquery - 重置这个 jQuery 动画

html - webkit 浏览器上的 CSS - 元素有时定位不正确

python - 使用 Flask 无法加载 CSS

css - 将 div 置于所有内容之上

html - CSS 列没有对齐