How to get the height of a DIV considering inner element's margins?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Consider de following markup: <div id="outerElement"> <div id="innerElement" style="border: 1px solid blue; background-color: #f0f3f5; margin-top: 100px"> TESTE </div> </div> I want to get the actual final height of outerElement using javascript . I noticed that if I remove the vertical margins from innerElement I am able to get what I want but I cannot alter styles from within the outerElement . How do I do this? Obs: I already tried height, scrollheight and offsetHeight in all browsers. Chrome gives me the expected value (including inner