CSSStyleDeclaration.getPropertyCSSValue()

Obsolete
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.

The 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.

You should use CSSStyleDeclaration.getPropertyValue() instead.

Syntax

var value = style.getPropertyCSSValue(property);

Parameters

  • 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.

Example

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();

Specifications

Specification Status Comment
Document Object Model (DOM) Level 2 Style Specification
The definition of 'CSSStyleDeclaration' in that specification.
Obsolete Declared as obsolete in July 2003.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic support
Deprecated
Chrome No support ? — 41
Notes
No support ? — 41
Notes
Notes See bug 331608.
Edge No support NoFirefox No support ? — 62
Notes
No support ? — 62
Notes
Notes Only returns a result if called on the result of getComputedStyle().
IE No support NoOpera No support 15 — 28
Notes
No support 15 — 28
Notes
Notes See bug 331608.
Safari Full support YesWebView Android Full support YesChrome Android No support ? — 41
Notes
No support ? — 41
Notes
Notes See bug 331608.
Edge Mobile No support NoFirefox Android No support ? — 62Opera Android No support 15 — 28
Notes
No support 15 — 28
Notes
Notes See bug 331608.
Safari iOS Full support YesSamsung Internet Android ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Deprecated. Not for use in new websites.
Deprecated. Not for use in new websites.
See implementation notes.
See implementation notes.

Document Tags and Contributors

Contributors to this page: connorshea, chrisdavidmills, david_ross, Qantas94Heavy
Last updated by: connorshea,