dom / latest / css / supports.html /

CSS.supports()

The CSS.supports() method returns a boolean value indicating if the browser supports a given CSS feature, or not.

Syntax

supports(propertyName, value)
supports(supportCondition)

Parameters

There are two distinct sets of parameters. The first one allows to test the support of a pair property-value:

propertyName

A string containing the name of the CSS property to check.

value

A string containing the value of the CSS property to check.

The second syntax takes one parameter matching the condition of @supports:

supportCondition

A string containing the condition to check.

Return value

true if the browser supports the rule, otherwise false.

Examples

result = CSS.supports("text-decoration-style", "blink");
result = CSS.supports("display: flex");
result = CSS.supports("(--foo: red)");

result = CSS.supports(`(transform-style: preserve) or (-moz-transform-style: preserve) or
                       (-o-transform-style: preserve) or (-webkit-transform-style: preserve)`);

// result is true or false

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
supports
61
28
Version 60 or older didn't support parentheses-less one-argument version.
12
Edge doesn't support parentheses-less one-argument version.
55
22
Version 54 or older didn't support parentheses-less one-argument version.
No
12.1
9
61
37
Version 60 or older didn't support parentheses-less one-argument version.
61
28
Version 60 or older didn't support parentheses-less one-argument version.
55
22
Version 54 or older didn't support parentheses-less one-argument version.
12.1
9
8.0
1.5
Samsung Internet 8.0 or older didn't support parentheses-less one-argument version.

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/CSS/supports