开发者

How to make a parent object in CSS menu stay in hover state when children are hovered over

I'm trying to make a menu work so that the menu remains in hover state when it's submenu/child menu is selected:

see example here: http://cssdesk.com/5vJP6

If anyone could explain what needs to be added to the CSS to make this work that would be great. I don't want开发者_Python百科 to use any external javascript to make this happen!

I've had a look at a couple of similar questions here, but none of their answers worked for me

thanks


I added this:

#menuh ul li:hover a  {color: black !important; border-bottom: 1px dashed #C1D9F0 !important;   }
#menuh ul li:hover li a {color: #505050 !important;}
#menuh ul li:hover li a:hover   {color:  #297BB6 !important;  } 

Which resolved my problem :-)


Define the :hover on the li element instead of the link, for example:

#menuh li:hover A
{
}

(Dito for all a:hovers)

However this won't work in IE6. You'll need to have to JavaScript solution there.


This was super helpful! Here's what I ended up using to make sure the background and font color of my main nav didn't override the sub nav

#nav ul li:hover a  {background-color: #353535; color: #A98C0C;}
#nav ul li:hover li a {background:none; color: #aaa; }
#nav ul li:hover li a:hover   {background:none; color: #fff;   } 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜