Bootstrap网站 - 标题中的错位

时间:2014-05-27 12:54:16

标签: html twitter-bootstrap

我有一个基于Bootstrap的HTML页面,但我不知道为什么左侧菜单与黑色标题条不对齐。我认为这是一个小错字,但我找不到它。有人可以帮忙吗?

<!-- NAVBAR
================================================== -->
  <body>
    <div class="navbar-wrapper">
      <div class="container">

        <div class="navbar navbar-inverse navbar-static-top" role="navigation">
          <div class="container">

            <div class="navbar-header">
              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
              </button>
              <a class="navbar-brand" href="#">Project name</a>
            </div>

            <!-- Left hand side menu --> 

            <div class="navbar-collapse collapse">
              <ul class="nav navbar-nav">
                <li class="active"><a href="#">Home</a></li>
                 <li><a href="#about">About</a></li>
                <li><a href="#contact">Contact</a></li>
                <li class="dropdown">
                  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown<b class="caret"></b></a>
                  <ul class="dropdown-menu">
                    <li><a href="#">Action</a></li>
                    <li><a href="#">Another action</a></li>
                    <li><a href="#">Something else here</a></li>
                    <li class="divider"></li>
                    <li class="dropdown-header">Nav header</li>
                    <li><a href="#">Separated link</a></li>
                    <li><a href="#">One more separated link</a></li>
                  </ul>
                </li>
              </ul>
            <!-- right hand side menu -->
              <ul>
                <form class="navbar-form navbar-right" role="form">
                  <div class="form-group">
                    <input type="text" placeholder="Email" class="form-control">
                  </div>
                  <div class="form-group">
                    <input type="password" placeholder="Password" class="form-control">
                  </div>
                  <button type="submit" class="btn btn-success">Sign in</button>
                </form>
              </ul>
            </div><!--/.navbar-collapse -->

          </div>
        </div>

      </div>
    </div>

... main part of the website  ...


这是结果:

enter image description here

1 个答案:

答案 0 :(得分:1)

导航栏中的<div class="container">似乎应为class="container-fluid"。而不是

<div class="navbar navbar-inverse navbar-static-top" role="navigation">
    <div class="container">

<div class="navbar navbar-inverse navbar-static-top" role="navigation">
    <div class="container-fluid">

请参阅JSFiddle