HTML CSS Bootstrap Javascript Icons Python
JavaScript Reference
JS Reference
JS Array Object JS Boolean Object JS Date Object JS Style Declaration Object JS Error Object JS Global Object JS Math Object JS Number Object JS String Object JS RegExp Object JS Statements
DOM Reference
DOM Attribute DOM Console DOM Document DOM Element DOM Events DOM Event Objects DOM History DOM HTMLCollection DOM Location DOM Navigator DOM Screen DOM Style DOM Window WEB Storage

The CSSStyleDeclaration

The CSSStyleDeclaration represents an object that is a CSS declaration block, that exposes style information and various style-related methods and properties.

CSSStyleDeclaration Object

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

Run code deals with the inline styles of a single element.

window.getComputedStyle() exposes the CSSStyleDeclaration object as a read-only interface.

CSSStyleDeclaration Object Properties

The following table lists the properties of the CSSStyleDeclaration object:

Property Description
cssText Sets or returns the textual representation of a CSS declaration block
length Returns the number of style declarations in a CSS declaration block
parentRule Returns a CSS rule that is the parent of the style block

CSSStyleDeclaration Object Methods

The following table lists the methods of the CSSStyleDeclaration object:

Method Description
getPropertyPriority() Returns whether or not the specified CSS property has the "!important" rule set
getPropertyValue() Returns the value of the specified CSS property
item() Returns the CSS property name from a CSS declaration block, by index
removeProperty() Removes a CSS property from a CSS declaration block
setProperty() Sets a new or modifies an existing CSS property in a CSS declaration block