Media

CSSMediaRule 是一个表示单个CSS @media  规则的接口。它实现  CSSConditionRule 接口,因此 CSSGroupingRule  和  CSSRule 接口类型值为 4(CSSRule.MEDIA_RULE).。

Syntax

The syntax is described using the WebIDL format.

interface CSSMediaRule : CSSConditionRule {
    readonly attribute MediaList media;
}

Properties

As a CSSConditionRule, and therefore both a CSSGroupingRule and a CSSRule, CSSMediaRule also implements the properties of these interfaces. It has the following specific property:

CSSMediaRule.media 只读
Specifies a MediaList representing the intended destination medium for style information.

Methods

As a CSSConditionRule, and therefore both a CSSGroupingRule and a CSSRule, CSSMediaRule also implements the methods of that interface. It has no specific methods.

Specification

Specification Status Comment
CSS Conditional Rules Module Level 3
CSSMediaRule
Candidate Recommendation Make it derived from the CSSConditionRule.
CSS Object Model (CSSOM)
CSSMediaRule
Working Draft No changes from Document Object Model (DOM) Level 2 Style Specification
Document Object Model (DOM) Level 2 Style Specification
CSSMediaRule
Recommendation  

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support ? (Yes) [1] ? ? ?
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support ? 17.0 (17) [1] ? ? ?

[1] Setting the value of conditionText on Gecko is only possible from Firefox 20 onwards.

文档标签和贡献者