过时
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

CSSStyleDeclaration.getPropertyCSSValue() method interface returns a CSSValue containing the CSS value for a property. Note that it returns null if the property name is a shorthand property.

应使用 CSSStyleDeclaration.getPropertyValue() 代替。

句法

var value = style.getPropertyCSSValue(property);
					

参数

  • property DOMString representing the property name to be retrieved.

返回值

  • value CSSValue containing the CSS value for a property. If none exists, returns null .

范例

The following JavaScript code gets an object containing the computed RGB values of the color CSS property:

var style = window.getComputedStyle(elem, null);
var rgbObj = style.getPropertyCSSValue('color').getRGBColorValue();
					

规范

规范 状态 注释
Document Object Model (DOM) Level 2 Style Specification
The definition of 'CSSStyleDeclaration' in that specification.
过时 Declared as obsolete in July 2003 .

浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
getPropertyCSSValue 弃用 Chrome ? — 41
不支持 ? — 41
bug 331608 .
Edge No
不支持 No
bug 331608 .
Firefox 1 — 62
不支持 1 — 62
Only returns a result if called on the result of getComputedStyle() .
IE No Opera 15 — 28
不支持 15 — 28
bug 331608 .
Safari 6 WebView Android ? — 41
不支持 ? — 41
bug 331608 .
Chrome Android ? — 41
不支持 ? — 41
bug 331608 .
Firefox Android 4 — 62 Opera Android 14 — 28
不支持 14 — 28
bug 331608 .
Safari iOS Yes Samsung Internet Android ? — 4.0
不支持 ? — 4.0
bug 331608 .

图例

完整支持

完整支持

不支持

不支持

弃用。不要用于新网站。

弃用。不要用于新网站。

见实现注意事项。

元数据

  • 最后修改: