Hi guys I am trying to make CSS drop down menu (no javascript involved). According to http://pixelspread.com/blog/289/css-drop-down-menu I only need to add
#menuBar #test2 a:hover .subMenu{display:block;}
to make the sub menu show up. However, in my code, it doesn't work. Could someone help me about this issue? Thanks a lot!
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>
My 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{
// I add .subMenu after a:hover and have two a:hover for #test2 a
// I know it won't work but not sure what to do now.
//thanks for the help.
display:block;
}
.subMenu{ // the hidden menu
position:absolute;
top:35px;
left:0px;
z-index: 99999;
width:550px;
background-color:black;
display:none;
}