我正在尝试编写我的团队网站。导航栏不会在移动屏幕上折叠。我添加了"数据目标"定位列表中的类。单击按钮时,列表应该会崩溃,但它没有。
<!-- Navbar -->
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="/Home">Team 3774</a>
</div>
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navHeaderCollapse">
<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="collapse navbar-collapse navHeaderCollapse" style="height: 0.866667px;">
<ul class="nav navbar-nav">
<li><a href="/Team Bio">Team Bio</a></li>
<li><a href="/Our Coach">Our Coach</a></li>
<li><a href="/Gallery">Gallery</a></li>
<li><a href="/Outreach">Outreach</a></li>
<li><a href="/Youtube">Youtube</a></li>
</ul>
</div>
</div>
</div>
答案 0 :(得分:0)
style="height: 0.866667px;"
您有两个navbar-header类(删除第二个类并组合按钮和品牌锚。这是工作导航栏的一个方面:https://jsfiddle.net/AndrewL32/e0d8my79/6/
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="/Home">Team 3774</a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navHead">
<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="collapse navbar-collapse" id="navHead">
<ul class="nav navbar-nav pull-right">
<li><a href="/Team Bio">Team Bio</a></li>
<li><a href="/Our Coach">Our Coach</a></li>
<li><a href="/Gallery">Gallery</a></li>
<li><a href="/Outreach">Outreach</a></li>
<li><a href="/Youtube">Youtube</a></li>
</ul>
</div>
</div>
</div>
答案 1 :(得分:0)
试试这个:
<div class="navbar navbar-inverse navbar-fixed-top" role="banner">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navHeaderCollapse">
<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="/Home">Team 3774</a>
</div>
<div class="collapse navbar-collapse navHeaderCollapse" role="navigation">
<ul class="nav navbar-nav">
<li><a href="/Team Bio">Team Bio</a></li>
<li><a href="/Our Coach">Our Coach</a></li>
<li><a href="/Gallery">Gallery</a></li>
<li><a href="/Outreach">Outreach</a></li>
<li><a href="/Youtube">Youtube</a></li>
</ul>
</div>
</div>
</div>