gpt4 book ai didi

jquery - 隐藏在div后面的下拉菜单

转载 作者:行者123 更新时间:2023-11-28 09:37:18 29 4
gpt4 key购买 nike

有人可以帮我解决这个问题吗?我的下拉菜单一直隐藏在我的 div 后面。每当我将鼠标悬停在它的链接上时,它就在左右 div 的后面。我需要添加 jQuery 来解决这个问题吗?我想不通这个问题。提前致谢!

#header{
z-index: 1;
position: fixed;
width: 600px;
margin-top: -20px;
height: 110px;
background-color: #98AFC7;
margin-bottom: 10px;
text-align:left;
font-family:Helvetica;

}
p{
text-align:center;
}

#nav{
position:fixed;
width:600px;
margin-top:90px;
height:60px;
background-color:#F3E88E;
margin-bottom:10px;
font-family:verdana;
font-size:50;

}
body{
height:600px;
width:800px;
margin-left:auto;
margin-right: auto;
text-align:left;
font-family:"Open Sans", "Helvetica Neue", Helvetica, Arial, Sans-Serif;
}


.left {
position: relative;
float: left;

width: 30%;
height: 450px;
background-color:#D1D0CE;
margin-bottom: 0px;
}

.right {
position: relative;
float: left;

width: 70%;
height: 450px;
background-color: #C2DFFF;
margin-bottom: 0px;
font-family:"Helvetica Neue";
font-size:14px;


}

#footer {
position: relative;
width:600px;
height: 50px;
background-color: #98AFC7;
clear: both;
font-family: Verdana, sans-serif;
font-size: 12px;
text-align: center;
color: #637c96;
}
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,600,300);
#cssmenu {
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, Sans-Serif;
font-size: 10px;
line-height: 15px;
text-transform: uppercase;
text-align: left;
z-index: 999999;

}
#cssmenu > ul {
width: auto;
list-style-type: none;
padding: 0;
margin: 0;
background: #ffffff;
border: 1px solid #ece6e8;
border-bottom: 3px solid #d9ced2;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
-o-border-radius: 2px;
border-radius: 2px;
}
#cssmenu > ul li#responsive-tab {
display: none;
/* Hide for large screens */

}
#cssmenu > ul li {
display: inline-block;
*display: inline;
zoom: 1;
}
#cssmenu > ul li.right {
float: right;
}
#cssmenu > ul li.has-sub {
position: relative;
}
#cssmenu > ul li.has-sub:hover ul {
display: block;
}
#cssmenu > ul li.has-sub ul {
display: none;
width: 250px;
position: absolute;
margin: 0;
padding: 0;
list-style-type: none;
background: #ffffff;
border: 1px solid #ece6e8;
border-bottom: 3px solid #d9ced2;
border-top: 0 none;
}
#cssmenu > ul li.has-sub ul li {
display: block;
}
#cssmenu > ul li.has-sub > a {
background-image: url('images/caret.png');
background-repeat: no-repeat;
background-position: 90% -95%;
}
#cssmenu > ul li.has-sub > a.active,
#cssmenu > ul li.has-sub > a:hover {
background: #95B9C7 url('images/caret.png') no-repeat;
background-position: 90% 195%;
}
#cssmenu > ul li a {
display: block;
padding: 12px 24px 11px 24px;
text-decoration: none;
color: #747474;
text-shadow: 0px 1px 0px #fff;
}
#cssmenu > ul li a.active,
#cssmenu > ul li a:hover {
background: #95B9C7;
color: #fff;
text-shadow: 0px 1px 0px #000;
}
@media (max-width: 600px) {
#cssmenu > ul {
width: 100%;
}
#cssmenu > ul li#responsive-tab {
display: block;
}
#cssmenu > ul li#responsive-tab a {
background: url('images/menu.png') no-repeat;
background-position: 95% -35%;
}
#cssmenu > ul li#responsive-tab a:hover {
background-color: #d80041;
background-position: 95% 135%;
}
#cssmenu > ul li {
display: none;
}
#cssmenu > ul li.right {
float: none;
}
#cssmenu > ul li.has-sub {
position: relative;
}
#cssmenu > ul li.has-sub ul {
display: block;
position: static;
width: 100%;
background: #ffffff;
border: 0 none;
}
#cssmenu > ul li.has-sub ul li {
display: block !important;
}
#cssmenu > ul li.has-sub ul li a span {
display: block;
padding-left: 24px;
}
#cssmenu > ul li.has-sub > a {
background-image: none;
}

}
/* Make sure they show even if hidden in mobile view by JS */
@media (min-width: 600px) {
#cssmenu > ul > li.collapsed {
display: inline-block !important;
*display: inline;
zoom: 1;
}
#cssmenu > ul ul li.collapsed {
display: block !important;
}

}

最佳答案

z-index 仅适用于定位元素(position:absolute、position:relative 或 position:fixed)。 #cssmenu 中没有定位元素。所以最好将#header 的 z-index 值更改为 -1。您的新代码是

#header{
z-index: -1;
position: fixed;
width: 600px;
margin-top: -20px;
height: 110px;
background-color: #98AFC7;
margin-bottom: 10px;
text-align:left;
font-family:Helvetica;

}

关于jquery - 隐藏在div后面的下拉菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25482675/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com