Skip to content

Instantly share code, notes, and snippets.

@ajace
Created July 18, 2013 15:08
Show Gist options
  • Save ajace/6030093 to your computer and use it in GitHub Desktop.
Save ajace/6030093 to your computer and use it in GitHub Desktop.
Cross-browser grayscale filter
.gray {
-webkit-filter: grayscale(100%);
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
filter: gray; /* IE 6-9 */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment