The CSSMediaRule
is an interface representing a single CSS @media
rule. It implements the CSSConditionRule
interface, and therefore the CSSGroupingRule
and the CSSRule
interface with a type value of 4
(CSSRule.MEDIA_RULE
).
The syntax is described using the WebIDL format.
interface CSSMediaRule : CSSConditionRule { readonly attribute MediaList media; }
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
Read only
MediaList
representing the intended destination medium for style information.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 | Status | Comment |
---|---|---|
CSS Conditional Rules Module Level 3 The definition of 'CSSMediaRule' in that specification. | Candidate Recommendation | Make it derived from the CSSConditionRule . |
CSS Object Model (CSSOM) The definition of 'CSSMediaRule' in that specification. | Working Draft | No changes from Document Object Model (DOM) Level 2 Style Specification |
Document Object Model (DOM) Level 2 Style Specification The definition of 'CSSMediaRule' in that specification. | Obsolete |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | 45.0 | (Yes) | (Yes) [1] | ? | ? | ? |
Feature | Android | Android Webview | Edge | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|
Basic support | ? | 45.0 | (Yes) | 17.0 (17) [1] | ? | ? | ? | 45.0 |
[1] Setting the value of conditionText
on Gecko is only possible from Firefox 20 onwards.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/CSSMediaRule