CSSStyleDeclaration parentRule attribute
Definition and Usage
parentRule
The attribute returns a CSSRule object representing the CSS rule set (selector and declaration block).
Example
Return CSS declarations and CSS selectors:
var s = document.styleSheets[0].rules[0].style; var ruleObj = s.parentRule; document.getElementById("demo").innerHTML = ruleObj.cssText;
Syntax
Returns the parentRule property:
object.parentRule
Technical Details
DOM Version: | CSS Object Model |
---|---|
Return Value: | CSSRule Object |
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 9.0 | Support | Support | Support |