The CSS.supports() static method returns a boolean value indicating if the browser supports a given CSS feature, or not.
The CSS.supports() static method returns a boolean value indicating if the browser supports a given CSS feature, or not.
js
CSS.supports(propertyName, value) CSS.supports(supportCondition)
There are two distinct sets of parameters. The first one allows to test the support of a pair property-value:
propertyNameA string containing the name of the CSS property to check.
valueA string containing the value of the CSS property to check.
The second syntax takes one parameter matching the condition of @supports:
supportConditionA string containing the condition to check.
true if the browser supports the rule, otherwise false.
js
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 (-webkit-transform-style: preserve)", ); // result is true or false
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
supports_static |
6128–61The parentheses-less one-argument version is not supported. |
7912–79The parentheses-less one-argument version is not supported. |
5522–55The parentheses-less one-argument version is not supported. |
No | 4815–48The parentheses-less one-argument version is not supported. |
119–11The parentheses-less one-argument version is not supported. |
614.4–61The parentheses-less one-argument version is not supported. |
6128–61The parentheses-less one-argument version is not supported. |
5522–55The parentheses-less one-argument version is not supported. |
4515–45The parentheses-less one-argument version is not supported. |
119–11The parentheses-less one-argument version is not supported. |
8.01.5–8.0The parentheses-less one-argument version is not supported. |
@supports at-rule that allows for the same functionality but in a declarative way. CSSSupportsRule CSSOM class allowing to manipulate @supports at-rules.
© 2005–2023 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_static