CSSStyleRule.style

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

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
styleChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 9Opera Full support YesSafari Full support 6WebView Android Full support 4.4Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support 1.0

Legend

Full support
Full support