Twitter BS3最大空间导航栏

时间:2014-03-07 19:01:47

标签: twitter-bootstrap-3 navbar

我的导航栏上有两种不同的表单,希望最大化使用的空间。正如您在此示例中所看到的那样 - http://jsfiddle.net/zb4dc/6/,理想情况下搜索会占用剩余空间。反正有没有让这项工作?

<body>
    <div class="navbar navbar-inverse navbar-fixed-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>
        </div>
        <div class="navbar-collapse collapse">
          <ul class="nav navbar-nav">
            <li class="active"><a href="/account">My Account</a></li>
          </ul>

          <form class="navbar-form navbar-left searchArea" role="search">
            <div class="form-group">
                <input id="searchBar" class="form-control typeahead" type="text" placeholder="Search">
            </div>
          </form>

          <form class="navbar-form navbar-right" role="tag">
                <div class="form-group">
                    <input id="userTags" type="text" class="form-control" placeholder="Tags">
                </div>
                <button id="addTags" type="submit" class="btn btn-default">Add Tags</button>&nbsp;
          </form>

        </div><!--/.nav-collapse -->
      </div>
    </div>
</body>

1 个答案:

答案 0 :(得分:0)

试试这个..

http://www.bootply.com/119937

<div class="navbar navbar-inverse navbar-fixed-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>
        </div>
        <div class="navbar-collapse collapse">
            <ul class="nav navbar-left navbar-nav">
              <li class="active"><a href="/account">My Account</a></li>
            </ul>
          <form class="navbar-form navbar-right" role="tag">
            <div class="form-group">
            <input id="userTags" type="text" class="form-control" placeholder="Tags">
            </div>
             <button id="addTags" type="submit" class="btn btn-default">Add Tags</button>
          </form>
          <form class="navbar-form">
            <div class="form-group" style="display:inline;">
              <div class="input-group">
                <input class="form-control" type="text">
                <span class="input-group-addon"><span class="glyphicon glyphicon-search"></span></span>
              </div>
            </div>
          </form>

        </div><!--/.nav-collapse -->
      </div>
</div>

似乎使其工作的唯一方法是使用“内联”和输入组。