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. Read only.
Specification
| Specification | Status | Comment |
|---|---|---|
| CSS Object Model (CSSOM) CSSStyleRule |
Working Draft | No changes |
| Document Object Model (DOM) Level 2 Style Specification CSSRule |
Recommendation |
Browser compatibility
To get browser compatibility information about the different type constant value, please consult the compatibility table of the associated interface.
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
| Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |