首先,让我们回顾一下我的代码:
HTML:
<div class="button_container">
<div class="inner_button">
<a href="#" class="button_text">Button</a>
</div>
<div class="button_side">
<i class="play" />
</div>
</div>
CSS:
.inner_button:hover {
background: red;
}
.button_container:hover > .button_side {
background-color: red !important;
}
如果悬停,上面的代码将让.button_side
悬停.button_container
。但现在我也想做相反的事情,这样如果.button_side
悬停它就会悬停.button_container
。我相信使用 CSS 会很困难,但我更喜欢它,但我对 JQuery 中的某些东西持开放态度。我怎样才能做到这一点?