将鼠标悬停在父项上时样式子元素 [英] Style child element when hover on parent
本文介绍了将鼠标悬停在父项上时样式子元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当父元素上悬停时,如何更改子元素的样式。我想更喜欢CSS解决方案,如果可能的话。有什么解决方案可能通过:hover CSS选择器。实际上,当面板上悬停一个面板时,我需要更改面板中的选项栏的颜色。
How to change the style of child element when there is hover on parent element. I would prefer a CSS solution for this if possible. Is there any solution possible through :hover CSS selectors. Actually I need to change color of options bar inside a panel when there is an hover on the panel.
寻找以支持所有主流浏览器。
Looking to support all major browsers.
推荐答案
是的,你绝对可以这样做。只需使用类似
Yes, you can definitely do this. Just use something like
.parent:hover .child {
/* ... */
}
根据此网页所有主要浏览器均支持此功能。
According to this page it's supported by all major browsers.
这篇关于将鼠标悬停在父项上时样式子元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文