CSSStyleRule represents a single CSS style rule. It implements the CSSRule interface with a type value of 1 (CSSRule.STYLE_RULE).


The syntax is described using the WebIDL format.

interface CSSStyleRule : CSSRule {
    attribute DOMString selectorText;
    readonly attribute CSSStyleDeclaration style;


Gets the textual representation of the selector for this rule, e.g. "h1,h2".
Returns the CSSStyleDeclaration object for the rule.


Specification Status Comment
CSS Object Model (CSSOM)
The definition of 'CSSStyleRule' in that specification.
Working Draft No changes
Document Object Model (DOM) Level 2 Style Specification
The definition of 'CSSRule' in that specification.

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support (Yes) (Yes) (Yes) (Yes) (Yes) (Yes)
Feature Android Edge Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support (Yes) (Yes) (Yes)
(Yes) (Yes) (Yes)

Document Tags and Contributors

 Contributors to this page: mt001mt, erikadoyle, Marsf, fscholz, harth, QFish, teoli, kscarfone, Sheppy, rioter, Sevenspade
 Last updated by: mt001mt,