I'm new to a web development. I am trying to create a navbar for my website. I took this script from bootstrap. I would like your advice on what href I should include in the line 2. I know what to put in the hrefs below that but I don't know what to include in the first one. I would like to click on the Lists
and get a choice Action Another and Something else.
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="what link to put here?" id="navbarDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Lists
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" href="#">Action</a></li>
<li><a class="dropdown-item" href="#">Another action</a></li>
<li><a class="dropdown-item" href="#">Something else here</a></li>
</ul>
</li>
</ul>
Try this:
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-expanded="false">
Lists
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" href="#">Action</a></li>
<li><a class="dropdown-item" href="#">Another action</a></li>
<li><a class="dropdown-item" href="#">Something else here</a></li>
</ul>
</li>
</ul>
The code is same except for the <a>
tag. You don't have to include the href in it. Instead, just change the data-bs-toggle
to data-toggle
.