我的導航下拉菜單出現問題。當我將它放在列表中時,它不會保持打開狀態。只要我離開最初的鏈接,它就會消失。我嘗試過,並且似乎無法找到問題。子菜單有時會打開,但在其他瀏覽器上它不會保持打開狀態。請幫忙。我的導航下拉菜單在懸停時不會保持打開狀態
CSS標記
nav {
list-style-type:none;
margin:0;
padding:0;
color:#FFF;
text-align:center;
max-width:960px;
margin-left:auto;
margin-right:auto;
text-decoration:none;
z-index:99;
}
nav ul li {
display:inline;
text-align:center;
color:#FFF;
text-decoration:none;
margin-left:30px;
margin-right:30px;
list-style-type:none;
position:relative;
padding:0;
height:auto;
}
nav ul li ul {
display:none;
position: absolute;
top: 100%;
width:800px;
background-color:#FFF;
transition: max-height 0.3s linear;
color:#171A58;
padding:2px;
height:auto;
}
nav ul li:hover ul {
display: block;
width:400px;
margin-top:10px;
padding:5px;
height:auto;
}
nav ul li ul li a {
display:block;
width:100%;
color:#171A58;
padding:7px;
text-align:left;
}
nav ul li ul li a:visited {
color:#171A58;
}
nav ul li ul li a:hover {
color:#F02204;
}
nav ul li ul li a:active {
color:#171A58;
}
HTML
<nav>
<!--Top Navigation Links (top horizontal navigation bar)-->
<ul>
<li><a href="page.html">Home</a></li>
<li><a href="#.html">About</a>
<ul>
<li><a href="metro-chiefs.html">Metro Chiefs</a></li>
<li><a href="ccfd.html">Clark County Fire Department</a></li>
</ul>
</li>
<li><a href="https://www.regonline.com/Register/Checkin.aspx?EventID=1558172" class="nav1">Registration</a></li>
<li><a href="conference.html">Conference</a></li>
<li><a href="sponsors.html" class="nav1">Sponsors</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</nav>
請幫助我。它一直在踢我的屁股。
謝謝!這工作,但現在下拉框不與容器排隊。任何修補程序? –
不確定你的意思。下面是一個純CSS下拉菜單系統的示例:http://jsfiddle.net/kboucher/nrAPu/ –