The conditionText
property of the CSSConditionRule
interface returns or sets the text of the CSS rule.
The conditionText
property of the CSSConditionRule
interface returns or sets the text of the CSS rule.
A string.
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)"
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 | 14.1 | 56 | 56 | 20 | 43 | 14.5 | 6.0 |
© 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/CSSConditionRule/conditionText