我有正确的代码,我在HEAD中使用了正确的CSS和JS链接。我不明白为什么这个下拉菜单不工作。向下箭头呈现,但当用户点击时没有任何React。
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<nav class="navbar navbar-expand-lg navbar-dark">
<div class="container-fluid d-lg-flex">
<a class="navbar-brand" href="index.html"><img src="https://via.placeholder.com/200" alt="Largs Model Boat Club Logo" style="width:200px;"></a>
<h1 class="display-1">Largs Model Boat Club</h1>
<div class="collapse navbar-collapse" id="navbartogg">
<ul class="navbar-nav ms-auto text-lg-end">
<li class="nav-item">
<a class="nav-link" href="gallery.html">Gallery</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="news_uc.html">News & Events</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Link 1</a></li>
<li><a class="dropdown-item" href="#">Link 2</a></li>
<li><a class="dropdown-item" href="#">Link 3</a></li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="aboutlargs_uc.html">About Largs</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="contactus.html">Contact Us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.html">Home</a>
</li>
</ul>
</div>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbartogg" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span>
</button>
</div>
</nav>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
1条答案
按热度按时间js4nwp541#
你只是放错了背景的颜色,你可以简单地添加
bg-dark
或删除navbar-dark