简体   繁体   中英

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

There are 2 other elements within it which are a h4 and another 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

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> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM