I am practicing my css using the hover when I notice this problem when I hover on top the color will change to blue and the middle will change to color red but when I hover to middle the middle changes the color to red but the top remains.
I tried to add a !important to the middle:hover but it didn't work. I also remove the + sign but i think it will not work since it should be on the same div for that to work.
why does the hover not working for the top div when middle div is hovered?
HTML
<div class="top">
<p> HELLO WORLD </p>
</div>
<div class="middle">
<p> HELLO PEOPLE </p>
</div>
CSS
.top:hover + .middle {
color:red;
}
.top:hover {
color:blue;
}
.middle:hover {
color:red;
}
.middle:hover + .top {
color: blue;
}
FIDDLE HERE