【发布时间】:2022-05-06 07:03:59
【问题描述】:
我有 3 个 div。当我将鼠标悬停在“main”/“first” div 上时,我想更改其中 2 个 div 中的一些内容。我真的,真的在这里试图避免使用任何 Javascript/jQuery。
我很确定这是可以做到的,我隐约记得不久前读过它,但我无法再次找到链接,而且我之前的搜索也没有帮助,可能是因为我可能没有使用正确的术语。
这是code: HTML:
<div id=one></div>
<div id=two></div>
<div id=three></div>
CSS:
#one{background-color:blue;width:50px;height:50px;float:left;}
#two{background-color:green;width:50px;height:50px;float:left;}
#three{background-color:red;width:50px;height:50px;float:right;}
#one:hover > #two + #three { background-color: yellow; }
有人可以帮忙吗?当我将鼠标悬停在第一个上时,如何让其他 两个 div 改变颜色?
【问题讨论】: