The CSSRule.style
property is the CSSStyleDeclaration
interface for the declaration block of the CSSRule
.
Syntax
styleObj = cssRule.style
Example
function stilo() {
alert(document.styleSheets[0].cssRules[0].style.cssText);
}
// displays "background-color: gray;"
Notes
The declaration block is that part of the style rule that appears within the braces and that actually provides the style definitions (for the selector, the part that comes before the braces).
See also
Specifications
Specification | Status | Comment |
---|---|---|
CSS Object Model (CSSOM)The definition of 'CSSStyleRule: style' in that specification. | Working Draft |
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.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
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 |
Legend
- Full support
- Full support
CSSStyleRule.style by Mozilla Contributors is licensed under CC-BY-SA 2.5.