CSSConditionRule: conditionText property

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

{{ APIRef("CSSOM") }}

The read-only **conditionText** property of the {{domxref("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 {{domxref("CSSMediaRule")}} which implements the {{domxref("CSSConditionRule")}} interface.

css
@media (width >= 500px) {
  body {
    color: blue;
  }
}
js
const targetRule = document.styleSheets[0].cssRules[0];
console.log(targetRule.conditionText); // "(width >= 500px)"

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also