Getting an element's inner height

后端 未结 5 595
说谎
说谎 2020-12-08 10:04

How do you get an element\'s inner height, without padding and borders?

No jQuery, just pure JS, and a cross-browser solution (IE7 included)

5条回答
  •  庸人自扰
    2020-12-08 10:29

    var style = window.getComputedStyle(document.getElementById("Example"), null);
    style.getPropertyValue("height");
    

    The above version will work in modern browsers. Please check currentStyle for IE browsers.

提交回复
热议问题