XML DOM CSSRule Object
- Previous Page DOM CSS2Properties
- Next Page DOM CSSStyleRule
CSSRule object
The CSSRule object is a base class used to define any rule in a CSS stylesheet, including rule sets (rule sets) and @ rules (at-rules).
There are several types of rules. These types do not share many common properties in the CSSRule interface, and most types have properties specifically designed for a particular type of rule.
Type of CSS Rule
Type | Corresponding Interfaces |
---|---|
CSSRule.STYLE_RULE | CSSStyleRule |
CSSRule.MEDIA_RULE | CSSMediaRule |
CSSRule.FONT_FACE_RULE | CSSFontFaceRule |
CSSRule.PAGE_RULE | CSSPageRule |
CSSRule.IMPORT_RULE | CSSImportRule |
CSSRule.CHARSET_RULE | CSSCharsetRule |
CSSRule.UNKNOWN_RULE | CSSUnknownRule |
Properties of CSSRule Object
- cssText
- Returns the text representation of the rule, for example "h1,h2 { font-size: 16pt }".
- parentRule
- Returns the rule containing the rule (if any) (for example, in a @media block style rule).
- parentStyleSheet
- Returns the stylesheet object to which the rule belongs.
- type
- Rule type, for example, CSSRule.CHARSET_RULE or CSSRule.IMPORT_RULE.
Note:All of the above properties are read-only.
Related Pages
XML DOM Reference Manual:CSSStyleRule Object
- Previous Page DOM CSS2Properties
- Next Page DOM CSSStyleRule