CSSConditionRule

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.

CSSConditionRule 对象表示单个条件 CSS 规则,由条件和语句块组成。继承至 CSSGroupingRule.

从它派生的两个对象 : CSSMediaRule and CSSSupportsRule.

Syntax

The syntax is described using the WebIDL format.

interface CSSConditionRule : CSSGroupingRule {
    attribute DOMString conditionText;
}

Properties

The CSSConditionRule derives from CSSRule, CSSGroupingRule and inherits all properties of these classes. It has one specific property:

CSSConditionRule.conditionText

Represents the text of the condition of the rule.

Methods

The CSSConditionRule derives from CSSRule, CSSGroupingRule and inherits all methods of these classes. It has no specific property of its own.

Specifications

Specification
CSS Conditional Rules Module Level 3
# the-cssconditionrule-interface

Browser compatibility

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
CSSConditionRule
conditionText

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

See also