Skip to content

Instantly share code, notes, and snippets.

@cheh
Last active December 14, 2015 01:19
Show Gist options
  • Save cheh/5005017 to your computer and use it in GitHub Desktop.
Save cheh/5005017 to your computer and use it in GitHub Desktop.
CSS: Gray Filter for All
.thumb {
-webkit-filter: grayscale(100%); // Chrome
filter: url("data:image/svg+xml;utf8,<svg%20xmlns='http://www.w3.org/2000/svg'><filter%20id='grayscale'><feColorMatrix%20type='matrix'%20values='0.3333%200.3333%200.3333%200%200%200.3333%200.3333%200.3333%200%200%200.3333%200.3333%200.3333%200%200%200%200%200%201%200'/></filter></svg>#grayscale"); // Firefox
&:hover {
-webkit-filter: grayscale(0%);
filter: none;
img {
filter: none;
}
}
img {
filter: gray; // IE
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment