CSS Style Declaration Object


CSSStyleDeclaration object

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


CSSStyleDeclaration Object Properties

AttributeDescription
cssTextSets or returns the style declaration text, cssText corresponds to the style attribute of the HTML element.
lengthReturns how many declarations are included in the style.
parentRuleReturns the rule containing the current rule.

CSSStyleDeclaration object methods

MethodsDescription
getPropertyPriority()Returns whether the specified CSS property has the "important!" property set.
getPropertyValue()Returns the specified CSS property value.
item()Returns the CSS property name in the CSS declaration by index.
removeProperty()Remove CSS properties from CSS declarations.
setProperty()Create or modify CSS properties in CSS declaration blocks.