(DOM) offsetHeight、clientHeight 與 scrollHeight

1、圖示

圖片描述圖片描述

2、解釋

三者都以px計。spa

  • offsetHeight:包括內容可見部分的高度border,可見的padding,水平方向的scrollbar(若是存在);不包括margincode

  • clientHeight:包括內容可見部分的高度,可見的padding;不包括border,水平方向的scrollbarmarginblog

  • scrollHeight:包括內容的高度(可見與不可見)padding(可見與不可見);不包括bordermargin圖片

offsetWidthclientWidthscrollHeight同理。get

3、參考

What is offsetHeight, clientHeight, scrollHeight?it

相關文章
相關標籤/搜索