Hello friends. I want to change the image on hover but my code is not working.
Code so far
<!DOCTYPE html>
<html>
<style>
a.rollover span.displace {
display: block;
width: 150px;
height: 44px;
text-decoration: none;
}
a.rollover span.displace img:hover {
background: url("images/red.png");
display: block;
}
</style>
<body>
<a href="#" class="rollover" title="Webvamp"><span class="displace"><img src="images/blue.png"/></a>
</body>
</html>
Any help is highly appreciated…
Code below should work.
CSS:
And HTML:
You are trying to place a background for an image which shows another image, so basically your background is hidden below image which is specified with src
If you want to have img – you can use solution from this answer:
Another option would be:
And CSS: