CSSStyleRule
represents a single CSS style rule. It implements the CSSRule
interface with a type value of 1
(CSSRule.STYLE_RULE
).
Properties
CSSStyleRule.selectorText
- Returns the textual representation of the selector for this rule, e.g.
"h1,h2"
. CSSStyleRule.style
Read only- Returns the
CSSStyleDeclaration
object for the rule. CSSStyleRule.styleMap
Read only- Returns a
StylePropertyMap
object which provides access to the rule's property-value pairs.
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.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
CSSStyleRule | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 9 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 4.4 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 |
selectorText | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 9 | Opera Full support Yes | Safari Full support 6 | WebView Android Full support 4.4 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 |
style | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 9 | Opera Full support Yes | Safari Full support 6 | WebView Android Full support 4.4 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 |
styleMap | Chrome Full support 65 | Edge Full support ≤79 | Firefox ? | IE ? | Opera Full support Yes | Safari ? | WebView Android Full support 65 | Chrome Android Full support 65 | Firefox Android ? | Opera Android Full support Yes | Safari iOS ? | Samsung Internet Android Full support 9.0 |
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown