Forum Moderators: not2easy

Message Too Old, No Replies

keeping a hover state for an li item on dropdown

         

surrealillusions

5:11 pm on Aug 20, 2010 (gmt 0)

10+ Year Member



Hi,

Have a problem to try and solve.
Basically I need to find a way of keeping a hover state for an <li> item (background colour) when theres a drop down menu (a sub <ul> list), of course, when hovering over the drop down menu the hover state for the <li> item goes away.

Is there a way of keeping that hover state while the drop down menu is in place?

The menu is all CSS. Is this solution also viable with CSS or would I need to go down the javascript route?

surrealillusions

8:39 pm on Aug 20, 2010 (gmt 0)

10+ Year Member



Found a CSS way.

The drop down menu is a <ul> list within the <li> item, so adding the hover state to the <li> is the way to go, as the <li> closes after the drop down menu.

Only problem is IE6 which doesn't support :hover on anything but <a> tags. However, this doesn't worry me too much with usage of IE6 dropping. Although there is the whatever:hover script out there for IE in case you do need to support it.

:)