Skip to content

Instantly share code, notes, and snippets.

@Tes3awy
Forked from bergantine/gist:5243223
Last active September 24, 2017 15:09
Show Gist options
  • Save Tes3awy/6dd5b45c1c6bbd8c673eb8421f4032c6 to your computer and use it in GitHub Desktop.
Save Tes3awy/6dd5b45c1c6bbd8c673eb8421f4032c6 to your computer and use it in GitHub Desktop.
CSS grayscale filter (go from grayscale to full color on hover) #css #sethneilson
/* At first the image is grayscaled by the filter and then on hover the filter is set to 0% */
img {
-moz-filter: grayscale(100%);
-o-filter: grayscale(100%);
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
-moz-transition: .5s ease-in-out;
-o-transition: .5s ease-in-out;
-webkit-transition: .5s ease-in-out;
transition: .5s ease-in-out;
}
img:hover {
-moz-filter: grayscale(0%);
-o-filter: grayscale(0%);
-webkit-filter: grayscale(0%);
filter: grayscale(0%);
-o-transition: .5s ease-in-out;
-moz-transition: .5s ease-in-out;
-webkit-transition: .5s ease-in-out;
transition: .5s ease-in-out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment