Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I detect whether CSS filter effects are supported?

Tags:

javascript

css

CSS Filter Effects is currently in draft, but already supported by chrome. It provides the possibility to apply effects to images:

The CSS filter property provides for effects like blurring or color shifting on an element’s rendering before the element is displayed. Filters are commonly used to adjust the rendering of an image, a background, or a border.

Included in the CSS standard are several functions that achieve predefined effects. You can also reference a filter specified in SVG with a URL to an SVG filter element. (source)

As far as I know, CSS filters effects are only supported in Chrome 18+ yet, however is it possible to detect the availability of CSS filter effects via JavaScript or some CSS tricks?

like image 943
asdaq7 Avatar asked Apr 24 '13 10:04

asdaq7


People also ask

Can I use CSS filter blur?

The filter CSS property applies graphical effects like blur or color shift to an element.

What are the different CSS filter you can use?

CSS Syntax filter: none | blur() | brightness() | contrast() | drop-shadow() | grayscale() | hue-rotate() | invert() | opacity() | saturate() | sepia() | url();

What is data filter in CSS?

<filter-function> The <filter-function> CSS data type represents a graphical effect that can change the appearance of an input image. It is used in the filter and backdrop-filter properties.

What is Filter URL in CSS?

The url() filter function takes in a reference to an SVG <filter> element that is to be applied to the element via the CSS filter property. The reference to the filter is the location of an XML file that specifies an SVG filter, and may include an anchor to a specific filter element.


1 Answers

You can use the Modernizr Javascript library for CSS3 feature detection I believe.

According to the following links, (as of Modernizr 2.6) Modernizr can now be used for CSS filter detection:

http://www.browserleaks.com/modernizr#filter

http://modernizr.com/news/ (under the test improvements section).

and http://modernizr.com/news/modernizr-260/.

like image 63
dsgriffin Avatar answered Sep 30 '22 17:09

dsgriffin