Let’s say I have the following:
<style> .myLabel { color: blue; } .myLabel:hover { color:red; } </style> <div> <img src='myimage.png' /> <span class='myLabel'>Image Label</span> </div>
Is it possible to replace the image (also via css) when they hover over the span? If so, how could I do that?
There don’t seem to be any sibling selector for previous siblings.
W3 defined adjacent siblings and some browser support seems to be available for general siblings — but, both are for following sibling(s).
So, I think you’ll find it easier to accomplish with
:hoverset to the div.And, I’ve never heard of CSS being capable of altering a
srcattribute. About the only way I can think that might work to alter an image via CSS is to havesrca transparent image and alterbackground-image.