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.

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.
Recommendation Declared as obsolete in July 2003.

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support No support1 No support (Yes)2 No support No support1, 3 (Yes)
Feature Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support (Yes) No support (Yes)2 No support No support1, 3 (Yes) No support1

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.

Document Tags and Contributors

 Contributors to this page: bunnybooboo, Qantas94Heavy
 Last updated by: bunnybooboo,