嗨,我是初学者
我想知道如何在新行中制作导航切换按钮
我总是得到这样的东西
它非常接近某些文字(nav-brand)
我认为这看起来很难看
这是我的代码
<div class="navbar navbar-inverse navbar-static-top">
<div class="container">
<a href="#" class="navbar-brand">My Site</a>
<button class="navbar-toggle" data-toggle="collapse" data-target=".navHeaderCollapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="collapse navbar-collapse navHeaderCollapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Menu2</a></li>
<li><a href="#">Menu3</a></li>
</ul>
</div>
</div>
</div>
答案 0 :(得分:2)
您遗失:<div class="navbar-header"></div>
完整代码:
<div class="navbar navbar-inverse navbar-static-top">
<div class="container">
<div class="navbar-header"><!-- Add this div here -->
<a href="#" class="navbar-brand">My Site</a>
<button class="navbar-toggle" data-toggle="collapse" data-target=".navHeaderCollapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div><!-- Make sure to end this div here -->
<div class="collapse navbar-collapse navHeaderCollapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Menu2</a></li>
<li><a href="#">Menu3</a></li>
</ul>
</div>
</div>
</div>