I'm curious why this one
<div class = "overlay">
fdsfsd
</div>
.overlay{
width: 100px;
height: 200px;
background-color:red;
}
alert(document.getElementsByClassName("overlay")[0].style.width);
is not alerting nothing. Of course I can write <div style = "width:100px">
then everthing works fine, but it is not good for me, I need css.
Here you can find a jsfiddle demo
So exact question is: why this code is not alerting width of div and how alert it if width is given by css?