Can you apply a CSS hover effect to an element that’s not a child of the hovered element?
Posted
by
WilliamB
on Stack Overflow
See other posts from Stack Overflow
or by WilliamB
Published on 2010-12-30T00:53:09Z
Indexed on
2010/12/30
1:54 UTC
Read the original article
Hit count: 157
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>
© Stack Overflow or respective owner