XML DOM CSSStyleSheet Object

CSSStyleSheet object

CSSStyleSheet object represents a single CSS stylesheet.

CSS style sheets are composed of CSS rules, which can be manipulated for each rule using the CSSRule object. The CSSStyleSheet object allows you to query, insert, and delete stylesheet rules.

You can obtain the list of style sheets for a given document using the document.styleSheets property (a collection of stylesheet objects).

Properties of the CSSStyleRule object

cssRules
Returns all CSS rules in the stylesheet in the form of an array.
disabled
This property indicates whether the current stylesheet has been applied. If it is true, the stylesheet is disabled and cannot be applied to the document. If it is false, the stylesheet is enabled and can be applied to the document.
href
Returns the location (URL) of the style sheet, or null if it is an inline style sheet.
media
Specifies the target medium expected for the style information.
ownerNode
Returns the node associated with the style sheet that links the document.
ownerRule
If the style sheet comes from an @import rule, the ownerRule property will contain CSSImportRule.
parentStyleSheet
Returns the style sheet containing the style sheet (if any).
title
Returns the title of the current style sheet. The title can be specified by referencing the title attribute of the <style> or <link> element of the style sheet.
type
Specifies the language of the style sheet for this style sheet. Represented as MIME type, the type of CSS style sheet is "text/css".

CSSStyleRule Object Method

Method Description
addRule() A specific to IE method for adding a rule to a style sheet.
deleteRule() A DOM standard method for deleting a rule from a specified position.
insertRule() A DOM standard method for inserting a new rule into the style sheet.
removeRule() A specific to IE method for deleting a rule of a specific rule.

Related Pages

XML DOM Reference Manual:CSSRule Object