CSSRule.style
property is the
CSSStyleDeclaration
interface for the
declaration block
的
CSSRule
.
styleObj = cssRule.style
function stilo() {
alert(document.styleSheets[0].cssRules[0].style.cssText);
}
// displays "background-color: gray;"
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).
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Object Model (CSSOM)
The definition of 'CSSStyleRule: style' in that specification. |
工作草案 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
style
|
Chrome 1 | Edge 12 | Firefox 1 | IE 9 | Opera Yes | Safari 6 | WebView Android 4.4 | Chrome Android 18 | Firefox Android 4 | Opera Android Yes | Safari iOS Yes | Samsung Internet Android 1.0 |
完整支持
CSSStyleRule
style
AnimationEvent
CSS
CSSConditionRule
CSSGroupingRule
CSSKeyframeRule
CSSKeyframesRule
CSSMediaRule
CSSNamespaceRule
CSSPageRule
CSSRule
CSSRuleList
CSSStyleDeclaration
CSSStyleSheet
CSSSupportsRule
CaretPosition
LinkStyle
MediaQueryList
MediaQueryListListener
Screen
StyleSheet
StyleSheetList
TransitionEvent