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.

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

浏览器兼容性

BCD tables only load in the browser