CSSStyleDeclaration parentRule attribute
Example
Return the style and CSS selector of the CSS declaration:
var
s
=
document
.
styleSheets
[
0
]
.
rules
[
0
]
.
style
;
var
ruleObj
=
s
.
parentRule
;
document
.
getElementById
(
"
demo
"
)
.
innerHTML
=
ruleObj
.
cssText
;
Try it »
Definition and usage
The parentRule attribute returns a CSSRule object containing the style and selector of the CSS declaration.
Browser support
| property | |||||
|---|---|---|---|---|---|
| parentRule | Yes | Yes | Yes | Yes | Yes |
Syntax
Return the parentRule attribute:
object.parentRule
Technical Details
| DOM version: | CSS Object Model |
|---|---|
| Return value: | CSSRule object |
CSS CSSStyleDeclaration