美文网首页
offsetHeight, clientHeight, scro

offsetHeight, clientHeight, scro

作者: 隔壁老王z | 来源:发表于2018-12-13 13:59 被阅读0次

clientHeight:

returns the inner height of an element in pixels, including padding but not the horizontal scrollbar height, border, or margin
返回像素表示的元素高度,包括 padding 但不包括水平滚动条高度,bordermargin

offsetHeight:

is a measurement which includes the element borders, the element vertical padding, the element horizontal scrollbar (if present, if rendered) and the element CSS height.
返回像素表示的元素高度加上包括borderpadding,水平滚动条高度

scrollHeight:

is a measurement of the height of an element's content including content not visible on the screen due to overflow

scrollHeight: ENTIRE content & padding (visible or not)
Height of all content + paddings, despite of height of the element.

clientHeight: VISIBLE content & padding
Only visible height: content portion limited by explicitly defined height of the element.

offsetHeight: VISIBLE content & padding + border + scrollbar
Height occupied by the element on document.


NANud.png
RFxSh.png

相关文章

网友评论

      本文标题:offsetHeight, clientHeight, scro

      本文链接:https://www.haomeiwen.com/subject/eqnvhqtx.html