From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/api/cssstylerule/style/index.html | 43 +++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 files/zh-cn/web/api/cssstylerule/style/index.html (limited to 'files/zh-cn/web/api/cssstylerule/style/index.html') diff --git a/files/zh-cn/web/api/cssstylerule/style/index.html b/files/zh-cn/web/api/cssstylerule/style/index.html new file mode 100644 index 0000000000..def2974719 --- /dev/null +++ b/files/zh-cn/web/api/cssstylerule/style/index.html @@ -0,0 +1,43 @@ +--- +title: style +slug: Web/API/CSSStyleRule/style +translation_of: Web/API/CSSStyleRule/style +--- +

{{ ApiRef() }}

+ +

概述

+ +

返回 一个 {{ domxref("CSSStyleDeclaration") }}接口对象,它代表了{{ DOMXref("CSSRule") }}的 declaration block

+ +

语法

+ +
styleObj = cssRule.style
+
+ +

例子

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

备注

+ +

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

+ +

相关链接

+ + + +

规范

+ +

DOM Level 2 CSS: style

+ +

{{ languages( {"en": "en/DOM/CSSStyleRule/style" } ) }}

+ +

浏览器兼容性

+ +

{{Compat("api.CSSStyleRule.style")}}

-- cgit v1.2.3-54-g00ecf