CSSConditionRule: conditionText property
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2021.
The read-onlyconditionText property oftheCSSConditionRule interface returns or sets the text of the CSSrule.
In this article
Value
A string.
Examples
The following example demonstrates reading the value ofconditionText on aCSSMediaRule which implements theCSSConditionRule interface.
css
@media (width >= 500px) { body { color: blue; }}js
const targetRule = document.styleSheets[0].cssRules[0];console.log(targetRule.conditionText); // "(width >= 500px)"Specifications
| Specification |
|---|
| CSS Conditional Rules Module Level 3> # dom-cssconditionrule-conditiontext> |