css - 全宽和对齐的导航栏

标签 css twitter-bootstrap navbar

<分区>

我是 css 和 javasript 的新手, 我使用默认的 twitter bootsrap 导航栏下拉,我希望我的导航栏内容占据导航栏整个空间的整个宽度, 我使用 http://twitter.github.com/bootstrap/examples/justified-nav.html 中的示例 但不起作用

这是我的html代码

<div class="row-fluid">
    <div class="span12">
        <div class="navbar">
            <div class="navbar-inner">
                <div class="container">
                    <ul class="nav">
                        <li><a href="#">About</a></li>
                        <li class="divider-vertical"></li>
                        <li class="span3"><a href="#">Portfolio</a></li>
                        <li class="divider-vertical"></li>
                        <li><a href="#">Contact</a></li>
                        <li class="divider-vertical"></li>
                    </ul>
                    <ul class="nav">
                        <li class="dropdown">
                            <a href="#"
                                class="dropdown-toggle"
                                data-toggle="dropdown">
                                Services
                                <b class="caret"></b>
                            </a>
                            <ul class="dropdown-menu">
                                <li><a href="#">Web Design</a></li>
                                <li><a href="#">Web development</a></li>
                                <li><a href="#">Wordpress Theme development</a></li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>

请帮忙

最佳答案

DEMO

修改后的 CSS:

    body {
    padding-top: 20px;
    padding-bottom: 60px;
  }

  /* Custom container */
  .container {
    margin: 0 auto;
    max-width: 1000px;
  }
  .container > hr {
    margin: 60px 0;
  }

  /* Main marketing message and sign up button */
  .jumbotron {
    margin: 80px 0;
    text-align: center;
  }
  .jumbotron h1 {
    font-size: 100px;
    line-height: 1;
  }
  .jumbotron .lead {
    font-size: 24px;
    line-height: 1.25;
  }
  .jumbotron .btn {
    font-size: 21px;
    padding: 14px 24px;
  }

  /* Supporting marketing content */
  .marketing {
    margin: 60px 0;
  }
  .marketing p + h4 {
    margin-top: 28px;
  }


  /* Customize the navbar links to be fill the entire space of the .navbar */
  .navbar .navbar-inner {
    padding: 0;
  }
  .navbar .nav {
    margin: 0;
    display: table;
    width: 100%;
  }
  .navbar .nav li {
    display: table-cell;
    width: 1%;
    float: none;
  }
  .navbar .nav li a {
    font-weight: bold;
    text-align: center;
    border-left: 1px solid rgba(255,255,255,.75);
    border-right: 1px solid rgba(0,0,0,.1);
  }
  .navbar .nav li:first-child a {
    border-left: 0;
    border-radius: 3px 0 0 3px;
  }
  .navbar .nav li:last-child a {
    border-right: 0;
    border-radius: 0 3px 3px 0;
  }

关于css - 全宽和对齐的导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15060084/

上一篇:jquery - css3 过渡而不是 .animate()

下一篇:css - 嵌套媒体对象 clearfix 不起作用

相关文章:

javascript - 通过 JavaScript 设置 2 个 div 的高度

jquery - 为大屏幕制作 3 行菜单

html - 在执行 TEI 时,无法让首字下沉的 css 跨度类起作用。它既不验证也不工作

css - 带空格的字体需要用引号括起来吗?

jquery - Twitter bootstrap - 为选项卡式导航添加动画/过渡效果

css - IE7 (ugg) 和布局问题

css - 如何针对 IE10+ 和特定屏幕尺寸?

jquery - Hover CSS 上的 iPad/iPhone Touch 事件

css - 浏览器缩放的媒体查询问题

html - 制作父级包含列的 Bootstrap 导航栏宽度