I am creating a navigation menu that includes a dropdown link labeled "More."
<a href="#"><div class="indiv_nav_button"><p class="font_18 white">Children</p></div></a>
<a href="#"><div class="indiv_nav_button"><p class="font_18 white">Homeware</p></div></a>
<a href="#"><div class="indiv_nav_button"><p class="font_18 white">Gifts</p></div></a>
<a href="#"><div class="indiv_nav_button"><p class="font_18 white">Clothing</p></div></a>
<a href="#"><div class="indiv_nav_button"><p class="font_18 white">Chocolate</p></div></a>
<a href="#">
<div class="indiv_nav_button">
<div class="dropdown">
<button class="dropbtn "><p class="font_18">More</p></button>
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
</div>
</a>
The issue I'm facing is that the dropdown works correctly outside of a container, but it doesn't display the "dropdown-content" properly within the navigation. Here is the CSS code used:
.dropbtn {
background-color: #696969;
color: white;
font-size: 16px;
border: none;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f1f1f1;
min-width: 160px;
min-height: 200px;
overflow: hidden;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 2;
}
.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;}
Note that the containers do not have a fixed height. Any assistance would be greatly appreciated.