English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

The getPropertyValue() method of CSSStyleDeclaration

 JavaScript CSSStyleDeclaration Object

The getPropertyValue() method returns the value of the specified CSS property.

Syntax:

object.getPropertyValue(property)
var declaration = document.styleSheets[0].rules[0].style;
var val = declaration.getPropertyValue('color');
document.getElementById("result").innerHTML = val;
Test and see‹/›

Browser Compatibility

All browsers fully support the getPropertyValue() method:

Method
getPropertyValue()YesYesYesYesYes

Parameter Value

ParameterDescription
propertyA string representing the name of the attribute to be checked

Technical Details

Return value:A string representing the attribute value
DOM Version:CSS Object Model

 JavaScript CSSStyleDeclaration Object