I am trying to make drop down menu. Some folks helped me on
CSS only drop down menu post.
Everything works fine except when I hover my mouse to my submenu. The hover state background image in my #menubar #test2 a:hover will return to #menubar #test2 a state. I really need to get this done and would appreciate if anyone could help me about it. Thanks a million.
My html
<ul id="menuBar">
<li id="test1">test1</li>
<li id="test2"><a href="#">Pro1</a>
<div class="subMenu">
<ul>
<li><a href="#">sub1</a></li>
<li><a href="#">sub2</a></li>
<li><a href="#">sub3</a></li>
</ul>
<ul>
<li><a href="#">Volleyball</a></li>
<li><a href="#">Walking</a></li>
<li><a href="#">Water Shoes</a></li>
</ul>
</div> <!--end of submenu-->
</li>
</ul>
CSS
#menuBar #test2 a{
background:url("../images/btTest.jpg") no-repeat bottom;
display:block;
border-right:1px solid #ffffff;
width:112px;
height:37px;
}
#menuBar #test2 a:hover{
background:url("../images/btTest.jpg") no-repeat top;
}
#menuBar #test2 a:hover + .subMenu { //submenu show up
display:block;
}
#menuBar li .subMenu:hover { //keep submenu show up when hover in submenu
display: block;
}
//the next one is not working....but I can't think of anything....
#menuBar li .subMenu:hover #menuBar #mens a {
background:url("../images/btMen.jpg") no-repeat top;
}
You need this:
To be this:
To get it to stick when you move to the
.subMenu. This will not work for IE6 (if you care).Also these:
Should be able to be replaced with just this: