How to avoid a:hover to act on img in CSS?

Posted by bodacydo on Stack Overflow See other posts from Stack Overflow or by bodacydo
Published on 2010-03-17T04:14:48Z Indexed on 2010/03/17 4:21 UTC
Read the original article Hit count: 463

Filed under:
|

Suppose I have the following selector:

a       { padding: 1em; }
a:hover { backgrond-color: #FF0000; }

And suppose I have the following HTML code:

<a href="http://stackoverflow.com"><img src="so.jpg"></a>

What happens is that <img> gets red-background color on mouse hover.

Any ideas how to fix it?

Thanks, Boda Cydo!

© Stack Overflow or respective owner

Related posts about html

Related posts about css