diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/cssstylerule/style/index.html | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/cssstylerule/style/index.html')
-rw-r--r-- | files/zh-cn/web/api/cssstylerule/style/index.html | 43 |
1 files changed, 43 insertions, 0 deletions
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 +--- +<p>{{ ApiRef() }}</p> + +<h3 id="Summary" name="Summary">概述</h3> + +<p>返回 一个 {{ domxref("CSSStyleDeclaration") }}接口对象,它代表了{{ DOMXref("CSSRule") }}的 <a class="external" href="http://www.w3.org/TR/1998/REC-CSS2-19980512/syndata.html#block">declaration block</a>。</p> + +<h3 id="Syntax" name="Syntax">语法</h3> + +<pre class="eval notranslate"><em>styleObj</em> = <em>cssRule</em>.style +</pre> + +<h3 id="Example" name="Example">例子</h3> + +<pre class="brush: js notranslate">function stilo() { + alert(document.styleSheets[0].cssRules[0].style.cssText); +} +// 弹出 "background-color: gray;" +</pre> + +<h3 id="Notes" name="Notes">备注</h3> + +<p>declaration block是样式规则中花括号内的部分(选择器就在花括号的外部)</p> + +<h3 id="相关链接">相关链接</h3> + +<ul> + <li><a href="/zh-cn/CSS/CSS_Reference" title="zh-cn/DOM/CSS">DOM CSS Properties</a></li> +</ul> + +<h3 id="Specification" name="Specification">规范</h3> + +<p><a class="external" href="http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleRule-style">DOM Level 2 CSS: style</a></p> + +<p>{{ languages( {"en": "en/DOM/CSSStyleRule/style" } ) }}</p> + +<h3 id="Specification" name="Specification">浏览器兼容性</h3> + +<p>{{Compat("api.CSSStyleRule.style")}}</p> |