Z
Z
ZaurK2018-02-12 13:39:39
css
ZaurK, 2018-02-12 13:39:39

Can this be done with css?

Hello!
There are two blocks

<div class="block1"></div>
<div class="block2"></div>

The task is. so that when hovering over one block, for example, change the color of another. Is it possible to do this with css or less? And if possible, please tell me how.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Koch, 2018-02-12
@ZaurK

<div class="a">Div A</div>
<div class="b">Div B</div>

.a:hover + .b { /* .a:hover ~ .b - если между элементами есть другие элементы */
    background: #007ffa;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question