翻译不完整。 请帮助我们翻译这篇文章!

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() 方法接口返回一个CSSValue 包含一个属性的CSS值。请注意,如果属性名称是速记属性,则返回null。


let value = style.getPropertyCSSValue(property);


  • property is a DOMString representing the property name to be retrieved.

Return value

  • value is a 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();


Specification Status Comment
Document Object Model (DOM) Level 2 Style Specification
Obsolete Declared as obsolete in July 2003.

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 未实现1 未实现 (Yes)2 未实现 未实现1, 3 (Yes)
Feature Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support (Yes) 未实现 (Yes)2 未实现 未实现1, 3 (Yes) 未实现1

1. Removed in Chrome 41/Opera 28, see Chromium bug 331608.

2. Firefox only returns a result if called on the result of getComputedStyle().

3. Calling this method in Opera 12.x and earlier throws a DOMException NOT_SUPPORTED_ERR.