I am trying to get the background color of the body, and I am wondering what is the difference between:
body.style.backgrounColor
and
wi
just using body.style.backgroundColor
will only be able to sense if an inline style is on the body and give you that (e.g. a style applied via the style
attribute in the html or using the style
property in JavaScript). getComputedStyle
also gets styles that were applied to it via stylesheets in tags, inherited styles from parent elements, and everything.
In short, body.style.backgroundColor
will get the background color that was in the style
attribute (