Display Images as Grayscale with CSS Filters
CSS filters aren't yet widely supported but they are indeed impressive and a modern need for web imagery. CSS filters allow you to modify the display of images in a variety of ways, one of those ways being displaying images as grayscale.
Doing so requires the most minimal of CSS:
img.bw {
filter: grayscale(1);
}
You can even animate an image to or from grayscale:
img.bw {
filter: grayscale(0);
}
img.bw.grey {
filter: grayscale(1);
transition-property: filter;
transition-duration: 1s;
}
CSS filters allow much more than just grayscale adjustments, so if you haven't taken the time, please play around with my CSS filter sandbox. Remember that if the user chooses to download the image, it is downloaded in its original colored displays, but for online display purposes, CSS filters do the trick!
![Detect DOM Node Insertions with JavaScript and CSS Animations]()
I work with an awesome cast of developers at Mozilla, and one of them in Daniel Buchner. Daniel's shared with me an awesome strategy for detecting when nodes have been injected into a parent node without using the deprecated DOM Events API.
![7 Essential JavaScript Functions]()
I remember the early days of JavaScript where you needed a simple function for just about everything because the browser vendors implemented features differently, and not just edge features, basic features, like addEventListener
and attachEvent
. Times have changed but there are still a few functions each developer should...
![WebKit Marquee CSS: Bringin’ Sexy Back]()
We all joke about the days of Web yesteryear. You remember them: stupid animated GIFs (flames and "coming soon" images, most notably), lame counters, guestbooks, applets, etc. Another "feature" we thought we had gotten rid of was the marquee. The marquee was a rudimentary, javascript-like...
![MooTools onLoad SmoothScrolling]()
SmoothScroll is a fantastic MooTools plugin but smooth scrolling only occurs when the anchor is on the same page. Making SmoothScroll work across pages is as easy as a few extra line of MooTools and a querystring variable.
The MooTools / PHP
Of course, this is a...
I knew about CSS filters, but what always restrained me to use them is that they’re limited to Webkit/Blink browsers. Firefox supports just the url syntax.
Many designers love them and for a reason. I just wish they were more widely supported.
I cant find the difference between the 3 images. All images seems to be the same color! Is this a browser problem (firefox) or i don’t see it?
Yes, it doesn’t display the CSS filters effect in Firefox and also Opera… Hopefully it will be cross-browser in the future.
I haven’t used css filters so far and this article fits perfectly for a design I want to implement.
Thanks so much, great stuff
Is there a Firefox workaround for this?
Grayscale is even better appreciated when used in action. It works perfectly on latest version of Chrome and firefox as seen on http://www.myweeblytricks.com/2014/09/weebly-tricks-72-grayscale-image.html
Unfortunately it does not work in IE11.
Check this, it worked for me perfectly: https://chrome.google.com/webstore/detail/grayscale-black-white-col/cjimlckjgclgboeebpjlipmokolejppk?hl=en (Chrome only) Using this app I can convert any web page to black & white color scheme.