css selectors - Can I use CSS :hover to effect another elements properties? -
i attempting change text links properties (different colour , text-decoration:underline;) when hovering on corresponding image.
this html:
<!-- wraps image, title, category --> <div class="itemwrap"> <!-- item image --> <a href="#" class="itemimagelink"><img class="itemimage" src="img/thumb.png" alt="thumb"></a> <!-- item title --> <div class="itemtitle"> <a href="#">the original soul of michael jackson</a> </div> <!-- item category --> <div class="itemcat"> <a href="#">12" picture disc</a> </div> </div><!-- close itemwrap -->
is possible when hovering on itemimage (which encased in anchor) properties of link within .itemtitle can changed?
it might worth noting itemwrap used multiple times on webpage.
thanks
you can use :hover
anywhere in compound selector, if can select elements want change while including :hover
, yes.
in case, can't itemimage
because involves backtracking dom, can itemimagelink
, instance:
.itemimagelink:hover ~ .itemtitle { ... }
Comments
Post a Comment