CSSConditionRule.conditionText
The conditionText
property of the CSSConditionRule
interface returns or sets the text of the CSS rule.
Syntax
var text = CSSConditionRule.conditionText cssConditionRule.conditionText = text
Value
A CSSOMString
.
Examples
The following example demonstrates getting and setting the value of conditionText
on a CSSMediaRule
which implements the CSSConditionRule
interface.
@media (min-width: 500px) { body { color: blue; } }
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 (CSS Conditional 3) # dom-cssconditionrule-conditiontext |
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 | |
conditionText |
56 |
12 |
20 |
No |
43 |
No |
56 |
56 |
20 |
43 |
No |
6.0 |
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/CSSConditionRule/conditionText