我已经发布了我的垂直下拉菜单的代码。一切都很好,除了当我从一个导航按钮到下一个导航按钮时。当您向下移动菜单并将鼠标悬停在按钮上时,会出现一个下拉菜单。你可以通过这个菜单向下移动就好了。当我转到下一个主按钮时,我的问题就来了。旧菜单弹出,然后新菜单弹出,鼠标位于新下拉菜单的中间。我希望它与下拉菜单的主按钮保持一致,直到用户再次移动它。这是我的代码,它可以复制和粘贴,并且可以很好地举例说明我在说什么
谢谢
<!DOCTYPE html>
<html lang="en">
<head>
<title>Page Title</title>
<meta charset="utf-8">
<style type="text/css">
body
{
background: grey;
}
.menu
{
width: 120%;
display: block;
float: right;
}
.menu ul
{
list-style: none;
}
.menu a
{
color: #000000;
display: block;
cursor: pointer;
background: #808080;
border: 1px solid #000000;
padding: 6px 2px 6px 2px;
font-size: small;
text-align: center;
text-decoration:none;
font-weight: bold;
width: 80%;
margin: auto;
-webkit-border-radius: 4px 4px 4px 4px;
-moz-border-radius: 4px 4px 4px 4px;
border-radius: 4px 4px 4px 4px;
-webkit-box-shadow: inset -2px -2px 2px 2px #181818;
-moz-box-shadow: inset -2px -2px 2px 2px #181818;
box-shadow: inset -2px -2px 2px 2px #181818;
}
.menu a:hover
{
color: #ffffff;
}
.menu a:active
{
-webkit-box-shadow: inset 1px 1px 1px 1px #181818;
-moz-box-shadow: inset 1px 1px 1px 1px #181818;
box-shadow: inset 1px 1px 1px 1px #181818;
}
.subMenu a
{
color: #ffffff;
cursor: pointer;
background: none;
border: none;
font-size: .80em;
text-align: left;
text-decoration:none;
font-weight: normal;
width: 100%;
margin-left: -20px;
border-radius: 0px 0px 0px 0px;
box-shadow: 0px 0px 0px 0px;
/*
border-bottom: 1px solid #000000;
border-left: 1px solid #000000;
*/
}
.subMenu a:hover
{
color: #ffffff;
background: #000000;
font-size: .90em;
}
.menu ul ul li
{
display:none;
}
.menu li:hover ul li
{
display:block;
}
</style>
</head>
<body>
<div style="width: 300px">
<div class="menu">
<ul>
<li><a href="index.htm" style="color: #ffffff">Home</a>
<div class="subMenu">
<ul>
<li><a href=index.htm#zombie>What is a Zombie</a></li>
<li><a href=index.htm#zombieApoc>What is the Zombie Apacolyspe</a></li>
</ul>
<br>
</div>
</li>
<li><a href="surviveFirstNight.htm">Surviving First Night</a>
<div class="subMenu">
<ul>
<li><a href=surviveFirstNight.htm#firstNight>What is First Night</a></li>
<li><a href=surviveFirstNight.htm#prepared>Prepare/Planning</a></li>
<li><a href=surviveFirstNight.htm#survivalKit>Zombie Survival Kit</a></li>
<li><a href=surviveFirstNight.htm#group>Form a Group</a></li>
</ul>
<br>
</div>
</li>
<li><a href="extendedSurvival.htm">Extended Survival</a>
<div class="subMenu">
<ul>
<li><a href=index.htm#zombie>What is a Zombie</a></li>
<li><a href=index.htm#zombieApoc>What is the Zombie Apacolyspe</a></li>
</ul>
<br>
</div>
</li>
<li><a href="weapons.htm">Weapons</a>
<div class="subMenu">
<ul>
<li><a href=weapons.htm#meele>Meele Weapons</a></li>
<li><a href=weapons.htm#firearms>Firearms</a></li>
<li><a href=weapons.htm#projectile>Projectile Weapons</a></li>
<!--<li><a href=weapons.htm#explosives>Explosives</a></li> -->
</ul>
<br>
</div>
</li>
<li><a href="humanElement.htm">Human Element</a>
<div class="subMenu">
<ul>
<li><a href=index.htm#zombie>What is a Zombie</a></li>
<li><a href=index.htm#zombieApoc>What is the Zombie Apacolyspe</a></li>
</ul>
<br>
</div>
</li>
<li><a href="refMaterial.htm">Reference Material</a>
<div class="subMenu">
<ul>
<li><a href=index.htm#zombie>What is a Zombie</a></li>
<li><a href=index.htm#zombieApoc>What is the Zombie Apacolyspe</a></li>
</ul>
<br>
</div>
</li>
</ul>
</div>
</div>
</body>
</html>