0

I have this image and I want to make it white by default and cyan by hover. Is there another way than to make 2 images, one white and one cyan?

enter image description here

George Irimiciuc
  • 4,355
  • 5
  • 40
  • 84

2 Answers2

1

You can make a PNG where the magnifying glass is transparent, then set the background color on the img tag in CSS:

img {
  background: steelblue;
}

img:hover {
  background: skyblue;
}

Demo: http://jsbin.com/jeqihuxo/2/edit

Patrick Oscity
  • 51,870
  • 16
  • 134
  • 161
1

Another way is to use sprites. Well, technically would not be two seperate images but one image which background-position is changed on hover. Your image is 36x48, so make a new image 72x48 with the non-hover version on the left side and the hover version on the right and move the background on hover.

Marc Eickhoff
  • 102
  • 11