css3 new selectors target on hover
Is there a way in css3 to target a div on hover, so if I have an sturucture like below could I target the divs as direct siblings of the h1?
<h1>item1</h1>
<div>this is the description for 1</div>
<h1>i开发者_运维百科tem2</h1>
<div>this is the description for 2</div>
<h1>item3</h1>
<div>this is the description for 3</div>
You can use the adjacent sibling combinator for this:
h1 + div:hover { ... }
Demo: http://jsfiddle.net/9P2hd/
W3C is your friend (at least most of the time): http://www.w3.org/TR/css3-selectors/
精彩评论