当用户将鼠标悬停在单词B上时,如何更改单词A的文本 colored颜色 ?例如,当用户将鼠标悬停在h1"My name is"上时,另一个h1"Paul"的文本应变为白色.
这个问题有什么解决办法吗?提前谢谢!
最新情况: 我想要的是文本"不是a"和"而是为了他们而在这里".当用户将鼠标悬停在单词Restaurant上时变为白色,而单词"Restaurant"应变为红色.第二部分("餐厅"变成红色)运行正常,但第一部分不起作用.
这是我使用的代码:
.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>