CSSStyleSheet
The CSSStyleSheet
interface represents a single CSS style sheet. It inherits properties and methods from its parent, StyleSheet
.
Documentation CSSStyleSheet by Mozilla Contributors, licensed under CC-BY-SA 2.5.
Instance Members
ownerRule: CSSRule
If this style sheet is imported into the document using an @import
rule, the ownerRule
property will return that CSSImportRule
, otherwise it returns null
.
cssRules: CSSRuleList
Returns a live CSSRuleList
, listing the CSSRule
objects in the style sheet.
This is normally used to access individual rules like this:
styleSheet.cssRules[i] // where i = 0..cssRules.length-1
To add or remove items in cssRules
, use the CSSStyleSheet
's deleteRule()
and insertRule()
methods, described below.
Inserts a new rule at the specified position in the style sheet, given the textual representation of the rule.
Name | Type | Default |
---|---|---|
rule |
String | |
index |
Int | 0 |
Returns |
---|
Int |
Deletes a rule at the specified position from the style sheet.
Name | Type |
---|---|
index |
Int |