+ 1

Change other element on hover

Hi i have hr into a div. I want change hr color when hover on div. How?

9th Mar 2022, 10:19 AM
Hadi
Hadi - avatar
4 Answers
9th Mar 2022, 11:56 AM
JaScript
JaScript - avatar
+ 1
hr:hover { background-color: yellow; }
9th Mar 2022, 10:58 AM
SoloProg
SoloProg - avatar
0
<div id="trigger">hover me</div> <hr id="aim"/> CSS: #trigger:hover+#aim{ color:red; } /*if it is not working, then #trigger:hover~#aim{ color:red; } /*that's it! /*happy coding.
9th Mar 2022, 1:23 PM
Shadoff
Shadoff - avatar