So I want to :hover on an element and I want the hovering to change an attribute of another class. How do I do it? I want to hover on to a button and it to change other div's display to display: block. I use only HTML and CSS.
You are limited by css, but there are possibilities with css selectors. I've made you a jsfiddle with a possible solution:
http://jsfiddle.net/6rT3Q/
CSS:
.item1:hover ~ .item3 {
background-color: red;
}
HTML
<div class="item1">
Hoverable item
</div>
<div class="item2">
Dummy item
</div>
<div class="item3">
Item to change
</div>
Here the ~ tells to look for succeeding elements. If you want the immediate next element you can use +.
More info about selectors:
http://www.w3.org/TR/2001/CR-css3-selectors-20011113/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With