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/cssstyledeclaration/getpropertycssvalue | |
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/cssstyledeclaration/getpropertycssvalue')
-rw-r--r-- | files/zh-cn/web/api/cssstyledeclaration/getpropertycssvalue/index.html | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/cssstyledeclaration/getpropertycssvalue/index.html b/files/zh-cn/web/api/cssstyledeclaration/getpropertycssvalue/index.html new file mode 100644 index 0000000000..732ae8229c --- /dev/null +++ b/files/zh-cn/web/api/cssstyledeclaration/getpropertycssvalue/index.html @@ -0,0 +1,61 @@ +--- +title: CSSStyleDeclaration.getPropertyCSSValue() +slug: Web/API/CSSStyleDeclaration/getPropertyCSSValue +tags: + - CSSOM + - Obsolete + - Reference +translation_of: Web/API/CSSStyleDeclaration/getPropertyCSSValue +--- +<p>{{ APIRef("CSSOM") }} {{Obsolete_header}}</p> + +<p><strong>CSSStyleDeclaration.getPropertyCSSValue()</strong> 方法接口返回一个{{domxref('CSSValue')}} 包含一个属性的CSS值。请注意,如果属性名称是速记属性,则返回null。</p> + +<p>现在你应该使用 {{domxref("CSSStyleDeclaration.getPropertyValue()")}}。</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox">let <em>value</em> = <em>style</em>.getPropertyCSSValue(<em>property</em>);</pre> + +<h3 id="参数">参数</h3> + +<ul> + <li><em><code>property</code></em> is a {{domxref('DOMString')}} representing the property name to be retrieved.</li> +</ul> + +<h3 id="返回值">返回值</h3> + +<ul> + <li><code><em>value</em></code> is a {{domxref('CSSValue')}} containing the CSS value for a property. If none exists, returns <code>null</code>.</li> +</ul> + +<h2 id="示例">示例</h2> + +<p>The following JavaScript code gets an object containing the computed RGB values of the <code>color</code> CSS property:</p> + +<pre class="brush: js">var style = window.getComputedStyle(elem, null); +var rgbObj = style.getPropertyCSSValue('color').getRGBColorValue(); +</pre> + +<h2 id="规范">规范</h2> + +<table> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('DOM2 Style', 'css.html#CSS-CSSStyleDeclaration', 'CSSStyleDeclaration')}}</td> + <td>{{Spec2('DOM2 Style')}}</td> + <td>Declared as obsolete in <a href="https://lists.w3.org/Archives/Public/www-style/2003Oct/0347.html">July 2003</a>.</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性"><strong>浏览器兼容性</strong></h2> + +<p>{{Compat("api.CSSStyleDeclaration.getPropertyCSSValue")}}</p> |