files/en-us/web/api/css/supports_static/index.md
{{APIRef("CSSOM")}}
The CSS.supports() static method returns a boolean value
indicating if the browser supports a given CSS feature, or not.
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:
propertyName
value
The second syntax takes one parameter matching the condition of {{cssxref("@supports")}}:
supportCondition
true if the browser supports the rule, otherwise false.
In the following examples, result is a boolean value indicating if the browser supports the given CSS feature.
result = CSS.supports("text-decoration-style", "blink");
result = CSS.supports("display: flex");
result = CSS.supports("(--foo: red)");
result = CSS.supports("selector(:has(a))");
result = CSS.supports(
"(transform-style: preserve) or (-moz-transform-style: preserve) or (-webkit-transform-style: preserve)",
);
For more examples and syntax features, see the {{cssxref("@supports")}} at-rule.
{{Specifications}}
{{Compat}}