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

CSS Style Declaration Object (CSSStyleDeclaration)

CSS Style Declaration Object (CSSStyleDeclaration)

CSSStyleDeclaration Object

The CSSStyleDeclaration object represents a collection of CSS property-value pairs.


CSSStyleDeclaration Object Properties

property Description
cssText Sets or returns the style declaration text; cssText corresponds to the style attribute of an HTML element.
length Returns the number of declarations contained in the style.
parentRule Returns the rule that contains the current rule.

CSSStyleDeclaration Object Methods

Method Description
getPropertyPriority() Returns whether the specified CSS property has the "important!" property set.
getPropertyValue() Returns the value of the specified CSS property.
item() Returns the CSS property name in the CSS declaration by index.
removeProperty() Removes a CSS property from the CSS declaration.
setProperty() Creates or modifies a CSS property in the CSS declaration block.