Visit Mozilla.org

DOM:stylesheet.insertRule

From MDC

« Gecko DOM Reference

Contents

[edit] Summary

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

[edit] Syntax

stylesheet.insertRule(rule, index) 

[edit] Parameters

  • rule is a string containing the rule to be inserted (selector and declaration).
  • index is a number representing the position to be inserted.

[edit] Example

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

[edit] 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.

[edit] Specification

insertRule