如何在导航栏中将其他项目放入右侧而其他项目位于左侧?

时间:2016-04-26 09:24:13

标签: bootstrapping

以下是我的代码段:

<div class="container">
    <div class="row">
        <div class="col-sm-10 col-sm-offset-1">
            <nav class="navbar  navbar-default">
                <div class="navbar-header">
                    <a class="navbar-brand" href="#">This is a LOGO </a>
                </div> 

                      <ul class="nav navbar-nav pull-right">
                      <li><a href="#" > Abous US </a></li>
                      <li><a href="#" > Contact US </a></li>     
                      <li><a href="#" > Acount </a></li>
                     </ul>
            </nav>
        </div>
    </div>
</div>

我的问题:如何将ABOUT USCONTACT US项目拉到右侧,ACOUNT位于左侧?

1 个答案:

答案 0 :(得分:0)

根据docs,您可以使用navbar-right将一些元素拉到右侧:

  <ul class="nav navbar-nav navbar-right">
    <li><a href="#">Link</a></li>
    <li class="dropdown">
      <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></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 role="separator" class="divider"></li>
        <li><a href="#">Separated link</a></li>
      </ul>
    </li>
  </ul>