Getting an element's inner height

后端 未结 5 609
说谎
说谎 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:53

    You can simply use the clientHeight and clientWidth properties.

    MDN web doc for Element.clientHeight — clientWidth works exactly the same way.

提交回复
热议问题