gpt4 book ai didi

CSS3 submenu 子菜单不能正常工作

转载 作者:行者123 更新时间:2023-11-28 12:53:03 26 4
gpt4 key购买 nike

我已经创建了一个用于创建菜单的 css3 样式表,在主菜单的子菜单中是正确的,但在创建子菜单之后。子菜单的子元素无法正常工作。

我想将子菜单的子菜单移动到父级的底部,我可以将鼠标光标移动到子级

JSFIDDLE

HTML:

<ul id="nav" class="nav" style='margin-right:0px;padding-right:0px;padding-top:0px;height:30px;'>
<li><a>MAIN MENU</a>
<ul>
<li><a href="#tab1">MENU 1</a>
<ul>
<li><a>SUBMENU</a></li>
</ul>
</li>
<li><a href="#tab2">MENU 2</a></li>
<li><a href="#tab3">MENU 3</a></li>
</ul>
</li>
</ul>

CSS3:

#nav {
color: #fff;
margin: 0;
line-height: 100%;
padding-top: 4px;
padding-bottom: 4px;
height: 33px;
background: -moz-linear-gradient(center top , #5E9AE2, #3570B8) repeat scroll 0 0 transparent;
z-index: 10000;
}
#nav li {
margin: 0pt 5px;
padding: 2pt 0pt 5px;
float: right;
position: relative;
list-style: none outside none;
z-index: 10000;
cursor: pointer;
}
#nav a {
color: #fff !important;
text-decoration: none;
display: block;
padding: 9px 10px;
margin-right: 0pt;
border-radius: 5px 5px 5px 5px;
font-weight: normal;
z-index: 100000;
cursor: pointer;
}
#nav .current a, #nav li:hover > a {
z-index: 100000;
background: #fff ! important;
color: #000 ! important;
box-shadow: 0pt 1px 1px rgba(0, 0, 0, 0.2);
}
#nav ul li:hover a, #nav li:hover li a {
z-index: 100000;
background: none repeat scroll 0% 0% transparent;
color: #000 ! important;
box-shadow: none;
}
#nav ul a:hover {
background: -moz-linear-gradient(center top , rgb(198, 71, 53), rgb(147, 35, 19)) repeat scroll 0% 0% transparent ! important;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#c44634), color-stop(100%,#952414)) repeat scroll 0% 0% transparent ! important; /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #c44634 0%,#952414 100%) repeat scroll 0% 0% transparent ! important; /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #c44634 0%,#952414 100%) repeat scroll 0% 0% transparent ! important; /* Opera 11.10+ */
background: -ms-linear-gradient(top, #c44634 0%,#952414 100%) repeat scroll 0% 0% transparent ! important; /* IE10+ */
background: linear-gradient(to bottom, #c44634 0%,#952414 100%) repeat scroll 0% 0% transparent ! important; /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#c44634', endColorstr='#952414',GradientType=0 ) ! important; /* IE6-9 */
color: rgb(255, 255, 255) ! important;
border-radius: 0pt 0pt 0pt 0pt;
text-shadow: 0pt 1px 1px rgba(0, 0, 0, 0.1);
cursor: pointer;
}
#nav ul {
background: #ffffff; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #cfcfcf 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#cfcfcf)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#cfcfcf 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#cfcfcf 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#cfcfcf 100%); /* IE10+ */
background: linear-gradient(to bottom, #ffffff 0%,#cfcfcf 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#cfcfcf',GradientType=0 ); /* IE6-9 */
display: none;
margin: 0pt;
padding: 0pt;
text-align: right;
width: 180px;/*طول منو*/
position: absolute;
top: 35px;
right: 0pt;
border-radius: 5px 5px 5px 5px;
direction: rtl;
box-shadow: 0pt 1px 3px rgba(0, 0, 0, 0.3);
}
#nav li:hover > ul {
display: block;
}
#nav ul li {
float: none;
margin: 0pt;
padding: 0pt;
}
#nav ul li ul{
float: none;
margin-top:28px;
margin-right: 180px;
top: 0px;
}
#nav ul li ul li:first-child > a {
border-radius: 5px 5px 5px 5px;

behavior: url('./css/PIE.htc');
}
#nav ul li ul li:last-child > a {
border-radius: 5px 5px 5px 5px;
behavior: url('./css/PIE.htc');
}

#nav ul a {
font-weight: normal;
text-shadow: 0pt 1px 1px rgba(255, 255, 255, 0.898);
}
#nav ul li:first-child > a {
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-radius: 5px 5px 0px 0px;
behavior: url('./css/PIE.htc');
}
#nav ul li:last-child > a {
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
border-radius: 0px 0px 5px 5px;
behavior: url('./css/PIE.htc');
}
#nav:after {
z-index: 100000;
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0pt;
height: 0pt;
}

这个方法没有问题,但我想要任何子菜单,但无法修复它。请帮助我,

最佳答案

#nav ul li ul {
float: none;
margin-right: 180px;
margin-top: 28px; /* <-- this is causing issue */
top: 0;
}

关于CSS3 submenu 子菜单不能正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16773738/

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