CSSRuleList

« CSSRuleList

Summary

A CSSRuleList is an array-like object containing an ordered collection of CSSRule objects.

Description

Each CSSRule can be accessed as rules.item(index), or simply rules[index], where rules is an object implementing the CSSRuleList interface, and index is the 0-based index of the rule, in the order as it appears in the style sheet CSS. The number of objects is rules.length.

Example

// get the first style sheet’s first rule
var first_rule = document.styleSheets[0].cssRules[0];

See also

CSSRuleList implementations

There are multiple properties in the CSSOM that will return a CSSRuleList. They are:

Specification

Document Tags and Contributors

Last updated by: teoli,