i'm doing this drop down menu that when "aulas" is hover a submenu appears. The problem is: I can't choose the link i want on the submenu because it desappears when aulas is not hover. Please, thank you so much.
我正在做这个下拉菜单,当“aulas”悬停时会出现一个子菜单。问题是:我不能在子菜单上选择我想要的链接,因为当aulas没有悬停时它会消失。拜托,非常感谢你。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
ul {
background-color: black;
color: white;
text-align: center;
padding: 6px;
width: 960px;
}
ul li {
display: inline;
font-family: thinn;
font-size: 25px;
margin: 20px;
position: relative;
left: -2px;}
ul li:hover {
background: black;
color: white;
}
ul li ul {
padding: 0;
position: absolute;
top: 30px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
}
ul li ul li {
background: grey;
display: block;
}
ul li:hover ul {
display: block;
opacity: 1;
visibility: visible;
position: absolute;
left: -30px;
width: 120px;
}
li.submenu{
font-size: 12pt;
width: 100px;
position: relative;
left: -10px;
background-color: black;
top: -10px;
}
a{
color: blue;
}
</style>
</head>
<body>
<ul><li>Home</li>
<li>Sobre</li>
<li>
Aulas
<ul>
<li class="submenu"><a href="">Quimica organica</a></li>
<li class="submenu"><a href="">Oxigenada</a></li>
</ul>
</li>
<li>Videos</li>
<li>Downloads</li>
<li>Contato</li>
</ul>
</body>`
1 个解决方案
#1
0
In the below rule, adjust top to 26px.
在以下规则中,将top调整为26px。
ul li ul {
padding: 0;
position: absolute;
top: 26px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
}
#1
0
In the below rule, adjust top to 26px.
在以下规则中,将top调整为26px。
ul li ul {
padding: 0;
position: absolute;
top: 26px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
}