navbar-collapse不会在图标下崩溃

时间:2014-12-26 01:45:47

标签: twitter-bootstrap

我正在尝试修复下拉菜单项放在图标旁边的部分,而不是图标下方。

<div class="navbar navbar-inverse navbar-static-top">
  <div class="container">
      <a href="#" class="navbar-brand" >D'Cartoon</a>
      <button class="navbar-toggle" data-toggle="collapse" data-target=".navHeaderCollapse">
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
      </button>
      <div class="collapse navbar-collapse navHeaderCollapse">
          <ul class="nav navbar-nav navbar-right">
              <li class="active"><a href="#">Home</a></li>
              <li class="dropdown">
                  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Social Media <b class="caret"></b></a>
                  <ul class="dropdown-menu">
                      <li><a href="#">Twitter</a> </li>
                      <li><a href="#">Facebook</a> </li>
                      <li><a href="#">Google+</a> </li>
                      <li><a href="#">Pinterest</a> </li>
                  </ul>
              </li>
              <li><a href="#about">About</a></li>
              <li><a href="#contact-us">Contact</a></li>
          </ul>
      </div>
  </div> 
</div>

1 个答案:

答案 0 :(得分:0)

试试这个 - http://jsfiddle.net/arty_/9hauc1sj/

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

            <a href="#" class="navbar-brand" >D'Cartoon</a>

            <div class="navbar-header">
                <div class="col-sm-12">
                    <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>
                </div>
            </div>

            <div id="main-nav" class="navbar-collapse collapse">
                <ul class="nav navbar-nav navbar-right">
                    <li class="active"><a href="#">Home</a></li>
                  <li class="dropdown">
                      <a href="#" class="dropdown-toggle" data-toggle="dropdown">Social Media <b class="caret"></b></a>
                      <ul class="dropdown-menu">
                          <li><a href="#">Twitter</a> </li>
                          <li><a href="#">Facebook</a> </li>
                          <li><a href="#">Google+</a> </li>
                          <li><a href="#">Pinterest</a> </li>
                      </ul>
                  </li>
                  <li><a href="#about">About</a></li>
                  <li><a href="#contact-us">Contact</a></li>
              </ul>
          </div>
      </div> 
    </nav>