问题
I have a dropdown menu and want to change background of parent's button when hovering submenus. Any ideas how to achieve this so it will work not only in all modern browsers but preferably in IE8/IE9 too?
Simple example, I want to change background of link "This black" while hovering his children ("When hover me" & "and me").
Is it possible with pure CSS?
http://jsfiddle.net/PExLW/
I was thinking about adding certain classes when hovering certain li but it sounds like an overkill, also, adding classes on hover doesn't sound like a good idea.
回答1:
sure, just take out the a
ul li:hover { ... }
example jsfiddle (or fullscreen)
来源:https://stackoverflow.com/questions/12849536/css-change-parents-background-on-hover