0

我有一个导航栏,里面有 4 个元素。第一个只是一个主页链接,第二个和第三个有下拉菜单,第四个是用下拉菜单向右拉的。

现在第二个和第三个元素的下拉菜单总是出现在第一个菜单项下,而不是在单击的菜单项下。

第四个没有这个问题,我做错了什么?

<div class="navbar navbar-fixed-top">
  <div class="navbar-inner">
    <div class="container">
      <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </a>
      <a class="brand" href="#"><span class="blue">art</span><span class="black">ly.de</span></a>
      <div class="pull-right">
        <ul class="nav">
          <li class="divider-vertical"></li>
          <li>
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
              <i class="icon-user"></i> Patrick Fraley
              <span class="icon-caret-down"></span>
            </a>
            <ul class="dropdown-menu">
              <li><a href="#"><i class="icon-edit"></i> Profile</a></li>
              <li><a href="#"><i class="icon-cog"></i> Account Settings</a></li>
              <li class="divider"></li>
              <li><a href="#"><i class="icon-signout"></i> Sign Out</a></li>
            </ul>
          </li>
        </ul>
      </div>
      <div class="nav-collapse">
        <ul class="nav">
          <li class="active"><a href="#">Dashboard</a></li>
          <li>
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
              Elements
              <span class="icon-caret-down"></span>
            </a>
            <ul class="dropdown-menu">
              <li><a href="#">Calendar</a></li>
              <li><a href="#">Forms</a></li>
              <li><a href="#">Graphs</a></li>
              <li><a href="#">Tables</a></li>
              <li><a href="#">Typography</a></li>
            </ul>
          </li>
          <li>
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
              Pages
              <span class="icon-caret-down"></span>
            </a>
            <ul class="dropdown-menu">
              <li><a href="#">Login</a></li>
              <li class="divider"></li>
              <li><a href="#">Error 404</a></li>
              <li><a href="#">Error 500</a></li>
            </ul>
        </ul>
      </div><!--/.nav-collapse -->
    </div>
  </div>
</div>
4

1 回答 1

3

我认为您忘记了class="dropdown"保存.nav li下拉列表的 s 。

你也错过了一个</li>

<div class="navbar navbar-fixed-top">
    <div class="navbar-inner">
        <div class="container">
            <!-- ... -->
            <div class="pull-right">
                <ul class="nav">
                    <li class="divider-vertical"/>
                    <li class="dropdown">
                        <!-- ... -->
                    </li>
                </ul>
            </div>
            <div class="nav-collapse">
                <ul class="nav">
                    <li class="active">
                        <!-- ... -->
                    </li>
                    <li class="dropdown">
                        <!-- ... -->
                    </li>
                    <li class="dropdown">
                        <!-- Missed this /li -->
                    </li>
                </ul>
            </div>
            <!--/.nav-collapse -->
        </div>
    </div>
</div>
于 2012-06-29T18:18:05.850 回答