I have used the toggler button using bootstrap 5 in the navbar but it is not displaying the navbar items that are collapsed on minimizing browser screen. Why is it not working properly? and how to resolve it?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" >
<title>
bootstrap installation
</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
</head>
<body>
<nav >
<a href="">tindog</a>
<button type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation">
<span ></span>
</button>
<div id="navbarTogglerDemo02">
<ul >
<li >
<a href="">Contact</a>
</li>
<li >
<a href="">Pricing</a>
</li>
<li >
<a href="">Download</a>
</li>
</ul>
</div>
</nav>
</body>
</html>
CodePudding user response:
The code you provided works fine for me. Are you sure you included the Bootstrap JS file?
CodePudding user response:
You are missing a bootstrap JS CDN link, Add this inside your head element
<head>
...
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-OERcA2EqjJCMA /3y gxIOqMEjwtxJY7qPCqsdltbNJuaOe923 mo//f6V8Qbsw3" crossorigin="anonymous"></script>
</head>