簡體   English   中英

懸停在下拉菜單選項合並在容器后面,如何獲得下拉菜單顯示在容器上方

[英]Hovering on the drop down the options is merged behind the container, how do i get the drop down options displayed over the container

懸停在下拉菜單(類別,排序依據)上,該選項在容器后無法查看,我如何獲得顯示在容器上方的下拉選項

.container {
    margin: 25px auto;
    position: relative;
    width: 800px;
    height:800px;
    background-color: #D8D8D8;
    padding-left: 10px;
    padding-right: 10px; 
}
h1 {
    text-align:center;
}

}
.categories {
    float: left;    
}
.sortby{
    float: center;  
}
.search{
    float:right;
}    
.container1 {
    position: relative;
    top: 150px;
    left: 200px;
    bottom: 300px;
    right: 400px;
    vertical-align: middle;
    position: absolute;
    width: 50%;
    background-color: #FFFFFF;
    border: solid 1px #0076a3;     
}

請在下面的小提琴鏈接中找到HTML和CSS的代碼: https ://jsfiddle.net/testnew/fne7njrb/

為下拉UL設置z-index:

li ul {
  display: none;
  z-index: 100; <--- Set this
}

您需要在下拉菜單上設置z-index css屬性。 然后它們將在其他元素上可見。 像這樣:

  li ul {display: none;z-index:5;}

希望對您有所幫助!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM