CSSStyleDeclaration getPropertyValue() Method

Definition and Usage

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

Example

Return the value of the color attribute:

var declaration = document.styleSheets[0].cssRules[0].style;
var propvalue = declaration.getPropertyValue("color");
alert(propvalue);

Try it yourself

Syntax

object.getPropertyValue(propertyname)

Parameters

Parameters Description
propertyname Required. A string representing the name of the attribute to check.

Technical Details

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

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 9.0 Support Support Support