Easy Tutorial
❮ Prop Style Marginleft Jsref Cos ❯

CSSStyleDeclaration parentRule Property

CSS CSSStyleDeclaration

Example

Returns the style and CSS selector of a CSS declaration:

var s = document.styleSheets[0].rules[0].style;
var ruleObj = s.parentRule;
document.getElementById("demo").innerHTML = ruleObj.cssText;

Definition and Usage

The parentRule property returns a CSSRule object, which includes 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

❮ Prop Style Marginleft Jsref Cos ❯