I am looking to take an icon that is colored (and will be a link) and turn it greyscale until the user places their mouse over the icon (where it would then color the image).
Is this possible to do, and in a way that is IE & Firefox supported?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are numerous methods of accomplishing this, which I’ll detail with a few examples below.
Pure CSS (using only one colored image)
You can find an article related to this technique here.
Pure CSS (using a grayscale and colored images)
This approach requires two copies of an image: one in grayscale and the other in full color. Using the CSS
:hoverpsuedoselector, you can update the background of your element to toggle between the two:This could also be accomplished by using a Javascript-based hover effect such as jQuery’s
hover()function in the same manner.Consider a Third-Party Library
The desaturate library is a common library that allows you to easily switch between a grayscale version and full-colored version of a given element or image.