style

概述

返回 一个 CSSStyleDeclaration接口对象,它代表了CSSRuledeclaration block

语法

styleObj = cssRule.style

例子

js

function stilo() {
  alert(document.styleSheets[0].cssRules[0].style.cssText);
}
// 弹出 "background-color: gray;"

备注

declaration block 是样式规则中花括号内的部分(选择器就在花括号的外部)

相关链接

规范

浏览器兼容性

BCD tables only load in the browser