jQuery : $('div.myclass').height() is not accurate

robe

New Member
I have a \[code\]<div>\[/code\] with CSS class \[code\]myclass\[/code\]. The CSS class is as follow:\[code\].myclass { position: absolute; width: 192px; font-size: 11px; background-color: #FFF; padding: 15px 15px 0; box-shadow: 0 1px 3px rgba(34, 25, 25, 0.4); -moz-box-shadow: 0 1px 3px rgba(34, 25, 25, 0.4); -webkit-box-shadow: 0 1px 3px rgba(34, 25, 25, 0.4); display: block;}\[/code\]It does not specify height. Contents are loaded dynamically by PHP. In jQuery's \[code\]$(document).ready(function() { });\[/code\], I debug the height of the div by:\[code\]console.log($('div.myclass').height()); // the result = 330\[/code\]HTML :\[code\]<div class="myclass"><img src="http://stackoverflow.com/questions/13762229/image.png" /><p>Text here text here</p></div>\[/code\]However, if I use the \[code\]Inspect Element\[/code\] feature in Google Chrome, it shows 531px. Why there is a difference? How can I get the \[code\]531px\[/code\] value?UPDATE: \[code\]$(this).outerHeight(); // 345px, as there is 15px margin\[/code\]
 
Back
Top