-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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