TOC PREV NEXT INDEX

domref



insertRule


The insertRule method inserts a new style rule into the current style sheet.

Syntax

stylesheet.insertRule(rule, index)
 

Parameters

rule is a string containing the rule to be inserted (selector and declaration)

index is a number representing the position to be inserted

Example

// push a new rule onto the top of my stylesheet
 
myStyle.insertRule("#blanc { color: white }", 0);
 

Notes

For rule sets this contains both the selector and the style declaration. For at-rules, this specifies both the at-identifier and the rule content.

Specification

insertRule
 

DOM cssRule Object


The cssRule object represents a single CSS style rule. These rules may be a part of a stylesheet or they may be placed in-line with the individual nodes in the HTML or XML document. Each stylesheet object exposes an array of the cssRules that make it up, and you can also get to the rules on individual elements by using the element.style property.

Properties

cssText returns the actual text of the style rule.
parentStyleSheet returns the stylesheet object in which the current rule is defined.
selectorText gets/sets the textual representation of the selector for the rule set.
style returns the declaration block for the current style.


Netscape Communications
http://developer.netscape.com
TOC PREV NEXT INDEX