<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="#">Jerrica</a>
<div class="container-fluid">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarTogglerDemo01">
<div class="navbar-nav">
<a class="nav-link active" aria-current="page" href="#">Home</a>
<a class="nav-link" href="#">Features</a>
<a class="nav-link" href="#">Pricing</a>
<a class="nav-link" href="#">Pricing</a>
</li>
</ul>
</nav>
**CSS**
body{
width:100%;
height:100%;
}
nav{
background:black;
height:10vh;
/* Align logo in center */
display:flex;
justify-content:center;
}
a:link {
color: white;
background-color: transparent;
text-decoration: none;
}
.a {
font-family: "Helvetica", "Arial", "Verdana";
}
我的汉堡包切换栏给我带来了问题,因为我的文本没有出现在那里。我相信,当我配置切换导航栏的CSS时,它会模糊汉堡菜单中的内容
缩进代码,这样您就可以轻松地检查未正确关闭的代码块。
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="#">Jerrica</a>
<div class="container-fluid">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarTogglerDemo01">
<div class="navbar-nav">
<a class="nav-link active" aria-current="page" href="#">Home</a>
<a class="nav-link" href="#">Features</a>
<a class="nav-link" href="#">Pricing</a>
<a class="nav-link" href="#">Pricing</a>
</div>
</div>
</div>
</nav>
</body>
当您这样做时,您会注意到您有关闭的li和ul标记,它们没有相应的打开标记,并且缺少3个div关闭标记。
在这个小提琴中,你可以检查你的菜单在所有块都关闭的情况下看起来如何。