引导程序导航栏中的两个独立链接

时间:2014-08-20 11:34:09

标签: twitter-bootstrap twitter-bootstrap-3 navbar

看看这个bootstrap导航栏:

<nav class="navbar navbar-default" role="navigation">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <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="#">Brand</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li class="active"><a href="#">Link</a></li>      
      </ul>     

    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>

我想在li中同时拥有两个链接。这是我需要的,但形状不合适。加号图标应位于演示中的链接文本旁边。

Demo

1 个答案:

答案 0 :(得分:2)

我会这样做:

  <ul class="nav navbar-nav">
      <li class="active"><a href="#">Link</a></li>
      <li class="active"><a href="#gotosite"><span class="glyphicon glyphicon-plus"></span></a></li>
  </ul> 

<强> DEMO

但如果这不符合您的要求,您可以将CSS用于原始代码

.nav>li>a {

display: inline-block;

}

<强> DEMO