How To Make Images Grayscale With Only CSS

There's no longer a need to fire up Photoshop and save a different version of your image. A new CSS3 filter can turn images grayscale (greyscale if you're British, or black and white if you prefer).

About This Script

To use this, simply copy the CSS from below to the <head> tag of your page. Then add the "grayscale" class to any image you want to make grayscale.

Demo

* Also compatible with non-pizza images.

Code

<style type="text/css"> /** * Greyscale image effect provided by http://www.top-site-list.com */ img.grayscale { 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 */ filter: gray; /* IE6-9 */ -webkit-filter: grayscale(100%); /* Chrome 19+, Safari 6+, Safari 6+ iOS */* } </style> <!-- Examples. You don't need to copy this part. --> <img class="grayscale" src="http://www.top-site-list.com/scripts/assets/grayscale-images/pizza3.jpg" /> <img src="http://www.top-site-list.com/scripts/assets/grayscale-images/pizza3.jpg" /> <img class="grayscale" src="http://www.top-site-list.com/scripts/assets/grayscale-images/pizza2.jpg" /> <img src="http://www.top-site-list.com/scripts/assets/grayscale-images/pizza2.jpg" />
More scripts

Do you want to expose your site to millions?
Do you want to be ranked higher in Google?
Do you want to be known as the best site in your niche?

Then look no further. Add your site in 3 simple steps. Sign up, Add your site and Start receiving votes! It only takes 10 seconds!

Sign Up to Top Site List Planet Now!

Login with one of these social networks...

Sign in with FacebookSign in with TwitterSign in with Google+Sign in with Yahoo!Sign in with LinkedIn

or create an account with your email...

Login To An Existing Account