我想将导航栏设置为反色;但是,除了汉堡菜单,navbar-brand和nav-item都在显示。当我将其更改为navbar-dark时,将再次显示汉堡菜单。是什么原因呢?
<nav class="navbar navbar-expand-lg navbar-inverse">
<a id="logo" class="navbar-brand" href="/">Logo</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-start" id="navbarSupportedContent">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link text-light" href="#">Browse</a>
</li>
</ul>
</div>
</nav>
答案 0 :(得分:1)
Bootstrap 4与Bootstrap 3相比有重大变化。
我用它从BS3升级到BS4 http://upgrade-bootstrap.bootply.com/
这是您的Bs4黑暗导航栏
<nav class="navbar navbar-expand-lg navbar-dark bg-dark navbar-expand-md"> <a id="logo" class="navbar-brand" href="/">Logo</a>
<button class="navbar-toggler"
type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-start" id="navbarSupportedContent">
<ul class="navbar-nav">
<li class="nav-item"> <a class="nav-link text-light" href="#">Browse</a>
</li>
</ul>
</div>