CSSStyleSheet.rules

Obsolete
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

rules is a deprecated legacy property of the CSSStyleSheet interface. Functionally identical to the preferred cssRules property, it provides access to a live-updating list of the CSS rules comprising the stylesheet.

Note: As a legacy property, you not use rules and should instead use the preferred cssRules. While rules is unlikely to be removed soon, its availability is not as widespread and using it will result in compatibility problems for your site or app.

Syntax

var rules = cssStyleSheet.rules;

Value

A live-updating CSSRuleList containing each of the CSS rules making up the stylesheet. Each entry in the rule list is a CSSRule object describing one rule making up the stylesheet.

Specifications

Specification Status Comment
CSS Object Model (CSSOM)
The definition of 'CSSStyleSheet.rules' in that specification.
Working Draft

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
rules
Deprecated
Chrome Full support YesEdge Full support 12Firefox Full support 68IE Full support 9Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 68Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support
Full support
Deprecated. Not for use in new websites.
Deprecated. Not for use in new websites.

See also