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 September 2015.
The read-only conditionText
property of
the CSSConditionRule
interface returns or sets the text of the CSS
rule.
Value
A string.
Examples
The following example demonstrates reading the value of
conditionText
on a CSSMediaRule
which implements the
CSSConditionRule
interface.
css
@media (min-width: 500px) {
body {
color: blue;
}
}
js
const targetRule = document.styleSheets[0].cssRules[0];
console.log(targetRule.conditionText); // "(min-width: 500px)"
Specifications
Specification |
---|
CSS Conditional Rules Module Level 3 # dom-cssconditionrule-conditiontext |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
conditionText |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.