我正在构建一个导航,最后一个链接是";更多";下拉菜单。
<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>
当在容器外时,下拉列表显示良好,但我似乎无法让它显示";下拉内容";它在导航中的位置。这是CSS。。
.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;}
容器没有固定的高度。谢谢你的帮助。
已回答。是溢出:隐藏;我没有注意到。谢谢