Can you apply a CSS hover effect to an element that’s not a child of the hovered element?
- by WilliamB
I was not sure if this is possible or not. I am working in CSS3 animations right now and I need to hover on a link that will effect other div element(non-child) on the page. I was not sure if there is a work around or not.
<style type="text/css">
#header {
background-color:red;
}
#header:hover .element {
background-color:blue;
}
.element {
background-color:green;
}
</style>
-
<header id="header">
<li><a href="#">Hover</a></li>
</header>
<div class="element" >
<p>hello world </p>
</div>