CSSMediaRule : CSSRule
Return to: HTML DOM Level 2 index

Represents a media rule in a CSS style sheet.

Platform Support

IE Mozilla Netscape Opera Safari
no 1.0+ no 9.0+ 1.0+

Constructors

Constructor Action IE Mozilla Netscape Opera Safari
CSSMediaRule Constructor() : CSSMediaRule
Represents a media rule in a CSS style sheet.
Show Details no 1.0+ no 9.0+ 1.0+

CSSMediaRule() : CSSMediaRule

Represents a media rule in a CSS style sheet.

Returns
CSSMediaRule

Visibility
internal

Inherited Properties

Property Action IE Mozilla Netscape Opera Safari
cssText : String
Text for the current CSS rule.
Show Details 6.0+ 1.0+ no 9.0+ 1.0+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/stylesheets.html

Remarks

If you specify an invalid value for cssText, the property may throw one of the following DOMExceptions:

  • HIERARCHY_REQUEST_ERR - CSS rule is not legal in the current location in the CSS style sheet.
  • INVALID_MODIFICATION_ERR - New value for the CSS rule is for a different type than the previous type.
  • NO_MODIFICATION_ALLOWED_ERR - The CSS rule or its parent CSS style sheet is read-only.
  • SYNTAX_ERR - CSS syntax error.
Availability

HTML DOM Level 2|W3C

parentRule : CSSRule
Parent rule for the current CSS rule.
Show Details 6.0+ 1.0+ no 9.0+ 1.0+
Availability

HTML DOM Level 2|W3C

parentStyleSheet : CSSStyleSheet
CSS style sheet that contains the rule.
Show Details no 1.0+ no 9.0+ 1.0+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/stylesheets.html

Availability

HTML DOM Level 2|W3C

type : Number
Type of CSS rule.
Show Details no 1.0+ no 9.0+ 1.0+
Availability

HTML DOM Level 2|W3C

Properties

Property Action IE Mozilla Netscape Opera Safari
cssRules : CSSRuleList
Array of all rules nested within the rule block.
Show Details no 1.0+ no 9.0+ 1.0+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/stylesheets.html

Availability

HTML DOM Level 2|W3C

media : MediaList
Array of media types that the nested rules apply to.
Show Details no 1.0+ no 9.0+ 1.0+
Availability

HTML DOM Level 2|W3C

Functions

Method Action IE Mozilla Netscape Opera Safari
deleteRule(Number index) : void
Deletes the specified rule from the CSSRules array.
Show Details no 1.0+ no 9.0+ no

Parameters
Number index Position in the CSSRules array where the rule to be deleted is located.

Returns
void

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/stylesheet_change.html

See Also

CSSMediaRule.insertRule

Availability

HTML DOM Level 2|W3C

insertRule(String rule, Number index) : Object
Inserts the specified rule into the CSSRules array at the specified position.
Show Details no 1.0+ no 9.0+ no

Parameters
String rule Rule to insert.
Number index Position to insert the rule in the CSSRules array.

Returns
Object

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/stylesheet_change.html

See Also

CSSMediaRule.deleteRule

Availability

HTML DOM Level 2|W3C

Availability

HTML DOM Level 2|W3C

text_javascript aptana_docs