style

概述

Returns the CSSStyleDeclaration interface for the declaration block of the CSSRule.

语法

styleObj = cssRule.style

例子

function stilo() {
  alert(document.styleSheets[0].cssRules[0].style.cssText);
}
// 弹出 "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).

相关链接

规范

DOM Level 2 CSS: style

文档标签和贡献者