我不是经验丰富的Bootstrap用户,而且我遇到以下问题:
<header class="header">
<nav class="primary-nav navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button class="navbar-toggle" data-target="#primary-nav" data-toggle="collapse" type="button">
<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="index.html">Hello</a>
</div>
<div class="collapse navbar-collapse" id="primary-nav">
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="index.html">Welcome</a></li>
<li><a href="#">Foo</a></li>
<li><a href="#">Bar</a></li>
</ul>
<form class="search navbar-form navbar-right" role="search">
<div class="form-group">
<label class="has-clear">
<input autocapitalize="off" autocomplete="off" autocorrect="off" class="form-control" id="search-input" placeholder="Search..." type="text">
<span aria-hidden="true" class="form-control-clear glyphicon " id="clear-search"></span>
</label>
</div>
</form>
</div>
</div>
</nav>
</header>
查看随播广告codepen。
通过这个非常简单的导航栏设置,有两件事我难以纠正:
margin-bottom
,imho 股票引导CSS应该处理这个但也许我&#39 ;我犯了一个错误虽然我可以管理1.但是我无法为导航栏的搜索输入获得正确的行为,该输入应该占据全宽并且当&#34; hamburger&#34;菜单出现。
提前感谢您的帮助。
答案 0 :(得分:0)
使用此css
#search-input{
width: 100px;//specify width according to your requirement
}
&#13;
答案 1 :(得分:0)
全屏显示
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<header>
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button class="navbar-toggle" data-target="#primary-nav" data-toggle="collapse" type="button">
<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="index.html">Hello</a>
</div>
<div class="collapse navbar-collapse" id="primary-nav">
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="index.html">Welcome</a>
</li>
<li><a href="#">Foo</a>
</li>
<li><a href="#">Bar</a>
</li>
</ul>
<form class="navbar-form" role="search">
<div class="form-group" style="display:inline;">
<div class="input-group" style="display:table;">
<input autocapitalize="off" autocomplete="off" autocorrect="off" class="form-control" id="search-input" placeholder="Search..." type="text">
<span class="input-group-addon" style="width:1%;"><span class="glyphicon glyphicon-search"></span></span>
</div>
</div>
</form>
</div>
</div>
</nav>
</header>
&#13;