A CSS declaration is an abstract concept not exposed as an object in the DOM. It represents a CSS property and value pairing.
A CSS declaration has the following associated properties:
The property name of the declaration, for example background-color.
The value of the declaration as a list of component values.
Either set or unset.
Set if the property name is defined to be case-sensitive according to the specification, otherwise unset.
The following example shows a CSS rule with a CSS declaration block for the <h1> element. The CSS declaration block is the lines between the curly braces, it contains two CSS declarations. One for font-style and another for color.
h1 {
font-style: italic;
color: rebeccapurple;
}
| Specification |
|---|
| CSS Object Model (CSSOM)> # css-declarations> |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/CSS_Object_Model/CSS_Declaration