导航组件无法正常工作,它不会扩展以显示屏幕尺寸小于768px的可用选项。这是我的代码。
<nav class="nav navbar-default">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-
toggle="collapse" data-taget="#navbar" >
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div id="navbar" class="navbar-collapse collapse" >
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Products</a></li>
</ul>
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<input type="text" class="form-control"
placeholder="Search" />
</div>
<button type="submit" class="btn btn-default">Submit
</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Subscribe</a></li>
</ul>
</div>
</nav>
答案 0 :(得分:0)
我更新了你的代码。
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="navbar">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Products</a></li>
</ul>
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search" />
</div>
<button type="submit" class="btn btn-default">Submit
</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Subscribe</a></li>
</ul>
</div>
</div>
</nav>
这是工作小提琴。