[英]i would like hover one element to affect other elements css
added a hover state on my main box element, i want it to turn grey and the text within to turn white 在我的主框元素上添加了一个悬停状态,我希望它变成灰色而其中的文本变成白色
this is the main element: .blogcont 这是主要元素:.blogcont
There are 2 other elements within it which are a h4 and another text div :.listing 其中还有2个其他元素,分别是h4和另一个text div:.listing
i would like to change the font color of the h4 and the other div to white upon hover state on .blogcont 我想在.blogcont悬停状态下将h4和另一个div的字体颜色更改为白色
Hope this helps! 希望这可以帮助!
.blogcont { width: 300px; height: 300px; background: red; color: black } .blogcont:hover { background: grey; } .blogcont:hover h4, .blogcont:hover .listing { color: white }
<div class="blogcont"> <h4>hellooo</h4> <div class="listing">listingggg</div> </div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.