Visit Mozilla.org

DOM:cssRule

From MDC

« Gecko DOM Reference

The CSSRule object represents a single CSS style rule. It may be a part of a stylesheet's cssRules list.

There are several kinds of rules. All of them share a few common properties on the CSSRule interface and most of them have some properties specific to a particular rule type.

Type Rule-specific interface Description
CSSRule.STYLE_RULECSSStyleRule
CSSRule.MEDIA_RULECSSMediaRule
CSSRule.FONT_FACE_RULECSSFontFaceRule
CSSRule.PAGE_RULECSSPageRule
CSSRule.IMPORT_RULECSSImportRule
CSSRule.CHARSET_RULECSSCharsetRule
CSSRule.UNKNOWN_RULECSSUnknownRule

Contents

[edit] CSSRule

cssText 
Returns the textual representation of the rule, e.g. "h1,h2 { font-size: 16pt }".
parentRule 
Returns the containing rule, if any (e.g. a style rule inside an @media block).
parentStyleSheet 
Returns the stylesheet object that this rule is part of.
type 
The type of the rule, e.g. CSSRule.CHARSET_RULE or CSSRule.IMPORT_RULE.

[edit] CSSStyleRule

selectorText 
Gets/sets the textual representation of the selector for this rule, e.g. "h1,h2".
style 
Returns the CSSStyleDeclaration object for the declaration block of the rule.

[edit] CSSStyleRule

[edit] CSSMediaRule

[edit] CSSFontFaceRule

[edit] CSSPageRule

[edit] CSSImportRule

[edit] CSSCharsetRule

[edit] CSSUnknownRule

[edit] Specification

DOM Level 2 CSS: CSSRule