An element’s computed style is the set of styles the browser resolves to apply after combining browser defaults, style sheets, the element’s style attribute, script changes, and inherited styles. section 12.3 section 12.3.3
Use `getComputedStyle(element)` to access the resolved styles, then call `getPropertyValue` with a CSS property name such as `background-color`.
- Unlike properties on an element’s `style` object, `getPropertyValue` takes dashed CSS names. A helper can convert camel-cased names such as `backgroundColor` to dashed form before querying. section 12.3.3
Querying a resolved value
An element can get its background color from a style sheet and its text color from an inline style. Querying computed style retrieves the resolved value for either property. section 12.3.3
Figure 12.2. The final style associated with an element can come from many things: the browser builtin styles (user agent style sheet), the styles assigned through the style property, and styles from the CSS rules defined in CSS code.
The figure maps the different sources that contribute to an element’s final style. section 12.3.3
