Issue
How can I change the textcolor of word A when the user hovers over word B? E.g. when the user hovers over the h1 "My name is", the text of the other h1 "Paul" should change to white.
Any solutions for this issue? Thanks in advance!
Update: I want the text "Not a" and "but here for them." to become white when the user hovers over the word restaurant and the word "restaurant" should become red. The second part (that "restaurant" becomes red) works fine, but the first part doesn`t work
This is the code im using:
.headingRestaurant:hover textb {
color: blue;
}
.headingRestaurant:hover {
color: red;
}
<h1 class="textb">Not a <span id="heading1" class="headingRestaurant">restaurant</span>, <br> but here for them.</h1>
Solution
You can do it like below:
.textb {
pointer-events: none;
}
.headingRestaurant {
pointer-events: initial;
}
.textb:hover {
color: blue;
}
.headingRestaurant:hover {
color: red;
}
<h1 class="textb">Not a <span id="heading1" class="headingRestaurant">restaurant</span>, <br> but here for them.</h1>
Answered By - Temani Afif
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.