Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSSStyleDeclaration getPropertyValue() method

CSSStyleDeclaration getPropertyValue() method

CSS CSSStyleDeclaration CSS CSSStyleDeclaration

Example

Returns the value of the color property:

var

declaration

=

document

.

styleSheets

[

0

]

.

cssRules

[

0

]

.

style

;

var

propvalue

=

declaration

.

getPropertyValue

(

"

color

"

)

;

alert

(

propvalue

)

;

Try it »


Definition and usage

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


Browser support

Method
getPropertyValue() Yes 9.0 Yes Yes Yes

Syntax



object.getPropertyValue(propertyname)


Attribute values

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

Technical Details

DOM version: CSS Object Model
Return value: A string representing the property value.

CSS CSSStyleDeclaration CSS CSSStyleDeclaration