0
當我在關於菜單中單擊時,下拉菜單在我停止關於其消失的關於菜單的菜單時不會保持打開狀態。如何讓它保持開放?如何在懸停時使下拉菜單保持打開狀態
CSS
#nav-line2 .subMenu{
position:absolute;
z-index:999;
list-style:none;
display:none;
padding-left:441px;
}
#about:hover + .subMenu , .subMenu:hover {display:block;}
HTML
<div id="nav-line2" style="float:left">
<a class="navlink" href="/whatwedo">what we do</a>
<a class="navlink" href="/communities">communities</a>
<a class="navlink" href="/catalog">gift catalog</a>
<a class="navlink" href="/studentprofiles">student profiles</a>
<a class="navlink" id="about" href="/aboutme">about</a>
<div class="subMenu">
<li><a class="navlink" href="/about">Board of Directors</a></li>
<li><a class="navlink" href="/accesgovernance">Structure & Governance</a></li>
</div>
<a class="navlink" href="/termsconditions" style="padding-left:10px">terms & conditions</a>
</div>
您的HTML無效。 'li'必須是'ul'的子代# –
看一看#id ul li:懸停ul li:懸停並且也是css選擇器> –
您需要使用jquery切換它,css:hover只能在hover – gardni