在Bootstrap 3.3.4中,我尝试在导航栏中放置一个输入组,该输入组跨越8个中心列,位于品牌名称旁边。不幸的是输入组似乎保持固定大小,或延伸输入组插件。与我想要达到的最接近的代码(模数这种拉伸)是这样的:
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="row">
<div class="col-xs-2">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapsible">
<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>
<div class="col-xs-8">
<form class="navbar-form">
<div class="form-group" style="width: 100%">
<div class="input-group" style="width: 100%">
<input type="text" class="form-control" style="width: 100%">
<span class="input-group-addon">
<span class="glyphicon glyphicon-search"></span>
</span>
</div>
</div>
</form>
</div>
</div>
答案 0 :(得分:1)
如果您为表单提供一个表单类,它将允许表单组根据需要延伸到100%。
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="row">
<div class="col-xs-2">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapsible">
<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>
<div class="col-xs-8">
<form class="form">
<div class="form-group">
<div class="input-group" style="">
<input type="text" class="form-control">
<span class="input-group-addon">
<span class="glyphicon glyphicon-search"></span>
</span>
</div>
</div>
</form>
</div>
</div>
</nav>