Needed a quick way to do a nice rollover effect with images today. The image needed to be grayscale, and then turn to color on hover. Turns out, there’s a great solution to that user the filter property. See below.
img {
filter: url(filters.svg#grayscale); /* Firefox 3.5+ */
filter: gray; /* IE5+ */
-webkit-filter: grayscale(1); /* Webkit Nightlies & Google Chrome Canary */
}
img:hover {
filter: none;
-webkit-filter: grayscale(0);
}
