In some browsers, including Chrome stable, you can do this:
h3 {
-webkit-filter: grayscale(1);
filter: grayscale(1);
}
And wouldn’t you know it, the h1 will be rendered completely in grayscale. Everything old is new again.
Anyway — does anyone know of any way to feature-detect for this?
I need to be able to apply other styles if fil filter won’t work.
So called UPDATED answer:
As the OP mentioned a good point I'm updating the answer but this does not have anything related or in contradict with my previous answer, this is simply a browser detection.
Alan H. mentioned that IE, prior to its 10th. version, supports
filter
css property but not in the way we all know about it (CSS3 filter
I meant).So If we want to feature detect
CSS3 filter
s only, we should go ahead and use a little browser-detection. As I mentioned in my comments.Using
documentMode
property, and combining it with our simple feature-detect we can exclude so called false positives in IE.Original Modernizr source
or
Extra information:
For just a simple feature detection use my codes above. For a list of supported functions, take a look at here:
For a live demonstration of
filter
s in Chrome, take a look at here:And 2 more resources for you:
As I'm writing this answer, you must use
webkit
vendor prefix to make it to work.