CSSStyleDeclaration parentRule Property
Examples
Return the style of 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 the CSSRule object, which contains the style and selector of the CSS declaration.
Browser Support
| Property | |||||
|---|---|---|---|---|---|
| parentRule | Yes | Yes | Yes | Yes | Yes |
Syntax
Return the parentRule property:
object.parentRule
Technical Details
| DOM Version: | CSS Object Model |
|---|---|
| Return Value: | CSSRule object |
CSS CSSStyleDeclaration