files/en-us/web/api/cssrule/index.md
{{APIRef("CSSOM")}}
The CSSRule interface represents a single CSS rule. There are several types of rules which inherit properties from CSSRule.
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.
"h1,h2 { font-size: 16pt }" or "@import 'url'". To access or modify parts of the rule (e.g., the value of "font-size" in the example) use the properties on the specialized interface for the rule's type (see above).null. E.g. if this rule is a style rule inside an {{cssxref("@media")}} block, the parent rule would be that {{domxref("CSSMediaRule")}}.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}}
{{Compat}}