docs.rodeo

MDN Web Docs mirror

CSSRule

{{APIRef("CSSOM")}} 

The CSSRule interface represents a single CSS rule. There are several types of rules which inherit properties from CSSRule.

Instance properties

The CSSRule interface specifies the properties common to all rules, while properties unique to specific rule types are specified in the more specialized interfaces for those rules’ respective types.

Examples

References to a CSSRule may be obtained by looking at a {{domxref("CSSStyleSheet")}} 's cssRules list.

let myRules = document.styleSheets[0].cssRules; // Returns a CSSRuleList
console.log(myRules);

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN