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
Actually, document.body.style.backgroundColor
will get only inline
style property
of an element like this
On the other hand window.getComputedStyle
will get
the actual property after CSS
and styles are applied to the element, for example, this is possible to get using window.getComputedStyle
body{
background-color:#fff;
}
But it's not possible to read css
style given above using document.body.style.backgroundColor
. Check this example. Also, check this.