当鼠标悬停在菜单上时,可以显示菜单项,但是我想使用“Tab”键聚焦在菜单上并且可以显示菜单项,但是不起作用,请问如何解决?
这是 HTML
<ul class="hMenu">
<li><a href="">prod1</a>
<div>
<a href="">test1</a>
<a href="">test2</a>
<a href="">test3</a>
</div>
</li>
<li><a href="javascript:void(0);" >prod2</a>
<div>
<a href="">test4</a>
<a href="">test5</a>
</div>
</li>
</ul>
这是CSS:
ul.hMenu li:hover a { color:red;}
ul.hMenu li div table{ background-color:yellow;}
ul.hMenu {
margin: 0;
padding: 0;
z-index: 1;
}
ul.hMenu li {
margin: 0;
padding: 0;
list-style: none;
float: left;
width:140px;
}
ul.hMenu li a {
display: block;
text-align: left;
text-decoration: none
}
ul.hMenu li div {
position: absolute;
display: none;
}
ul.hMenu div a {background: yellow;
}
ul.hMenu li :hover { background: yellow}
/**Mouse hover the menus can show up**/
ul.hMenu li:hover div{
display:block;
}
/**Why this line can not work when the "Tab" to focus on the menu?**/
ul.hMenu li :focus div{
display:block;
}