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 表示一条 CSS 样式规则。它实现了 CSSRule 接口,类型的值为 1CSSRule.STYLE_RULE)。

属性

CSSStyleRule.selectorText

返回这条规则的、文本格式的选择器,例如 "h1,h2"

CSSStyleRule.style 只读

返回这条规则的 CSSStyleDeclaration 对象。

CSSStyleRule.styleMap 只读

返回一个 StylePropertyMap 对象,which provides access to the rule's property-value pairs.

规范

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

浏览器兼容性

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.