I have downloaded a boostrap template online and is making modifications to the template. However, I'd like my menu bar to hoverable dropdowns for each item in the menu bar. I have this for the css of the dropdown:
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f1f1f1;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {background-color: #ddd;}
.dropdown:hover .dropdown-content {display: block;}
.dropdown:hover .dropbtn {background-color: #3e8e41;}
This is the html part:
<ul class="navbar-nav text-uppercase ml-auto dropdown">
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="#services">Services</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="#experts">Experts</a>
<ul class="dropdown-content">
<li><a href="#">Test dropdown</a></li>
</ul>
</li>
</ul>
I have been just following instructions online but I can't seem to get it right.
This is the output that I kept on getting:
It shows the submenu even if the cursor is not hovering over the menu.

Expertslink?dropdownclass to the relevantliand specify that you need.dropdown:hover > .dropdown-contentinstead of.dropdown:hover .dropdown-content, but I see that @HasuKimchi has beaten me to it :-)