CSSStyleSheet
interface represents a single CSS stylesheet, and lets you inspect and modify the list of rules contained in the stylesheet. It inherits properties and methods from its parent, StyleSheet
.CSSRule
objects representing each of the rules in the stylesheet. The rules are contained in a CSSRuleList
, which can be obtained from the stylesheet's cssRules
property.CSSStyleRule
object containing a style such as:Returns a live CSSRuleList
which maintains an up-to-date list of the CSSRule
objects that comprise the stylesheet.
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 insertRule()
and deleteRule()
methods.
CSSRuleList
If this stylesheet is imported into the document using an @import
rule, the ownerRule
property returns the corresponding CSSImportRule
; otherwise, this property's value is null
.
CSSRule
Deletes the rule at the specified index into the stylesheet's rule list.
number
. The index into the stylesheet's CSSRuleList
indicating the rule to be removed.Promise<void>
Inserts a new rule at the specified position in the stylesheet, given the textual representation of the rule.
string
. A string
containing the rule to be inserted. What the inserted rule must contain depends on its type:
number
. A positive integer less than or equal to stylesheet.cssRules.length
, representing the newly inserted rule's position in CSSStyleSheet.cssRules
. The default is 0
. (In older implementations, this was required. See Browser compatibility for details.)Promise<number>
disabled | href |
media | ownerNode |
parentStyleSheet | title |
type |