CSSStyleRule represents a single CSS style rule. It implements the CSSRule interface with a type value of 1 (CSSRule.STYLE_RULE).
Syntax
The syntax is described using the WebIDL format.
interface CSSStyleRule : CSSRule {
attribute DOMString selectorText;
readonly attribute CSSStyleDeclaration style;
};
Properties
CSSStyleRule.selectorText- Gets the textual representation of the selector for this rule, e.g.
"h1,h2". CSSStyleRule.style- Returns the
CSSStyleDeclarationobject for the rule.
Specifications
| 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. |
Obsolete |
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
| Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
| Basic support | Yes | Yes | Yes | 9 | Yes | Yes |
selectorText | Yes | Yes | Yes1 | 9 | Yes | Yes |
style | Yes | Yes | Yes | 9 | Yes | Yes |
| Feature | Android webview | Chrome for Android | Edge mobile | Firefox for Android | Opera Android | iOS Safari | Samsung Internet |
|---|---|---|---|---|---|---|---|
| Basic support | Yes | Yes | Yes | Yes | Yes | Yes | ? |
selectorText | Yes | Yes | Yes | Yes1 | Yes | Yes | ? |
style | Yes | Yes | Yes | Yes | Yes | Yes | ? |
1. Read-only; setting of this property not supported

