jQuery .width() and .height() strange behaviour
Posted
by Misha Moroshko
on Stack Overflow
See other posts from Stack Overflow
or by Misha Moroshko
Published on 2010-05-18T15:00:11Z
Indexed on
2010/05/18
15:10 UTC
Read the original article
Hit count: 246
Why in the following code .height() returns 95 rather than 100, while .width() returns 200 as expected ?
HTML:
<table><tr>
<td id="my"></td>
</tr></table>
<div id="log"></div>
CSS:
#my {
border: 5px solid red;
}
JS:
$("#my").width(200).height(100);
$("#log").append("Width = " + $("#my").width() + "<br />");
$("#log").append("Height = " + $("#my").height());
© Stack Overflow or respective owner