悬停时需要three更改样式six(使用 CSS)
body {
width: 200px;
height: 200px;
display: flex;
justify-content: space-between;
}
.three {
width: 20px;
height: 20px;
background-color: blue;
}
.six {
width: 20px;
height: 20px;
background-color: yellow;
}
<div class="one">
<div class="two">
<div class="three">
</div>
</div>
</div>
<div class="four">
<div class="five">
<div class="six">
</div>
</div>
</div>
谷歌搜索并没有找到任何东西
仅当元素处于同一级别时,您不能使用纯 CSS 执行此操作
CSS 选择器参考
使用 jQuery 会是这样的(关联):
理论上,这是不可能的。
但是你可能有点棘手。它适用于chrome,我没有在其他人中测试过。