View Full Version : Changing Image Color

07-07-2011, 05:21 PM
Hi there,

can anyone help with a code to change an image from one color to the next? I have the two images. The first is black the second is white. I want the black one to be always showing but when you put your mouse over the image it changes to the white one. I think its called hover over or something like that?

07-07-2011, 05:34 PM
so if you have two classes
you can do .blah:hover .hah{}
*note my syntax may be skewed bc im spoiled and VS fixes it for me :D

07-07-2011, 06:12 PM
If you give your image a class, like class="image1", then the css code would be image.image1:hover {background-image: url("images/image2.png");}

This is the only way I know how to do it off the top of my head. For hover effects I usually put image1 in a div and then give that div a background-image of image1. This is so I can easily have the hover effect I just showed you.