Web/API/CSSStyleRule/style

From Get docs

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

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
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