The CSSStyleDeclaration interface represents an object that is a CSS declaration block, and exposes style information and various style-related methods and properties.
A CSSStyleDeclaration object can be exposed using three different APIs:
- Via
HTMLElement.style, which deals with the inline styles of a single element (e.g.,<div style="…">). - Via the
CSSStyleSheetAPI. For example,document.styleSheets[0].cssRules[0].stylereturns aCSSStyleDeclarationobject on the first CSS rule in the document's first stylesheet. - Via
Window.getComputedStyle(), which exposes theCSSStyleDeclarationobject as a read-only interface.