CSSStyleDeclaration parentRule Property
Example
Return the CSS declaration and the CSS selector:
var s = document.styleSheets[0].rules[0].style;
var ruleObj = s.parentRule;
document.getElementById("demo").innerHTML = ruleObj.cssText;
Try it Yourself »
Definition and Usage
The parentRule property returns a CSSRule Object representing a CSS rule-set (selector and declaration block).
Browser Support
Property | |||||
---|---|---|---|---|---|
parentRule | Yes | 9.0 | Yes | Yes | Yes |
Syntax
Return the parentRule property:
object.parentRule
Technical Details
DOM Version: | CSS Object Model |
---|---|
Return Value: | A CSSRule Object |
❮ CSSStyleDeclaration Object