我遇到的问题是,当我将margin
添加到我的悬停在下拉菜单中时,它会混淆所有要删除的内容并将其全部聚集在它上面。虽然在添加margin
之前导航菜单工作得很好,是的,删除margin
修复了问题,但我需要添加margin
。
这是我的CSS,如果您还需要HTML,请告诉我。 (注意,我在Notepad ++上这样做,因为HTML> 4<)
#navmenu a {
text-decleration: none;
display: block;
width: 124px;
height: 27px;
line-height: 25px;
background-color: ;
border: 1px solid #CCC;
border-radius: 5px;
font-family: Magneto;
font-size: 20px;
color: ffffff;
transition: ease-in all 400ms;
-moz-transition: ease-in all 300ms;
-webkit-transition: ease-in all 300ms;
-o-transition: ease-in all 300ms;
margin: -40px;
}
#navmenucontainer {
margin: 15px;
margin-left: 10px;
width: 230px;
height: auto;
float: left;
}
以下是Relevent HTML:
<div id="navmenucontainer">
<ul id="navmenu">
<li>
<a href="#">Menu</a>
<ul>
<li><a href="file:///E:/ThursdayWebsites2/Education.html">Education</a>
</li>
<li><a href="#">Hobbies</a>
</li>
<li><a href="file:///E:/ThursdayWebsites2/Hobbies.html">Interests</a>
</li>
</ul>
</li>
</ul>
</div>
答案 0 :(得分:0)
演示 - http://jsfiddle.net/victor_007/fajLeLsy/
看起来你想要做这样的事情
请勿-margin
a
#navmenu a {
text-decleration: none;
display: block;
width: 124px;
height: 27px;
line-height: 25px;
background-color: ;
border: 1px solid #CCC;
border-radius: 5px;
font-family: Magneto;
font-size: 20px;
color: ffffff;
}
#navmenucontainer {
margin: 15px;
width: 230px;
height: auto;
}
ul {
margin: 0;
padding: 0;
list-style: none;
}
ul li:hover ul {
opacity: 1;
visibility: visible;
}
ul li ul {
opacity: 0;
visibility: hidden;
transition: ease-in all 400ms;
-moz-transition: ease-in all 300ms;
-webkit-transition: ease-in all 300ms;
-o-transition: ease-in all 300ms;
}
&#13;
<div id="navmenucontainer">
<ul id="navmenu">
<li> <a href="#">Menu</a>
<ul>
<li><a href="">Education</a>
</li>
<li><a href="#">Hobbies</a>
</li>
<li><a href="">Interests</a>
</li>
</ul>
</li>
</ul>
</div>
&#13;