此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

CSSConditionRule

基线 广泛可用

自 2021年4月 起,此特性已在主流浏览器中得到支持,可在大多数设备和浏览器版本中正常使用。

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

规范
CSS Conditional Rules Module Level 3
# the-cssconditionrule-interface

Browser compatibility

See also