Baseline Widely available
Instance propertiesThe 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.
CSSRule.cssText
Represents the textual representation of the rule, e.g., "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).
CSSRule.parentRule
Read only
Returns the containing rule, otherwise null
. E.g. if this rule is a style rule inside an @media
block, the parent rule would be that CSSMediaRule
.
CSSRule.parentStyleSheet
Read only
Returns the CSSStyleSheet
object for the style sheet that contains this rule
CSSRule.type
Read only Deprecated
Returns one of the Type constants to determine which type of rule is represented.
References to a CSSRule
may be obtained by looking at a CSSStyleSheet
's cssRules
list.
let myRules = document.styleSheets[0].cssRules; // Returns a CSSRuleList
console.log(myRules);
Specifications Browser compatibility See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4