CSSStyleRule

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2015.

* Some parts of this feature may have varying levels of support.

CSSStyleRule représente une règle de style CSS unique. Il implémente l'interface CSSRule avec une valeur de type 1 (CSSRule STYLE_RULE).

Syntaxe

La syntaxe est décrite à l'aide du format WebIDL.

interface CSSStyleRule : CSSRule {
    attribute DOMString selectorText;
    readonly attribute CSSStyleDeclaration style;
};

Properties

CSSStyleRule.selectorText

Obtient la représentation textuelle du sélecteur pour cette règle, par exemple "H1, H2".

CSSStyleRule.style

Retourne l'objet CSSStyleDeclaration pour cette règle.

Spécifications

Specification
CSS Object Model (CSSOM)
# the-cssstylerule-interface

Compatibilité des navigateurs

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
CSSStyleRule
cssRules
deleteRule
insertRule
selectorText
style
styleMap

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.