CSSConditionRule: conditionText property
The conditionText
property of
the CSSConditionRule
interface returns or sets the text of the CSS
rule.
Value
A string.
Examples
The following example demonstrates getting and setting the value of
conditionText
on a CSSMediaRule
which implements the
CSSConditionRule
interface.
css
@media (min-width: 500px) {
body {
color: blue;
}
}
js
let myRules = document.styleSheets[0].cssRules;
let text = myRules[0].conditionText;
console.log(text); // "(min-width: 500px)"
text = "(min-width: 400px)";
console.log(text); // "(min-width: 400px)"
Specifications
Specification |
---|
CSS Conditional Rules Module Level 3 # dom-cssconditionrule-conditiontext |
Browser compatibility
BCD tables only load in the browser