offsetHeight, clientHeight, scro

2018-12-13  本文已影响0人  隔壁老王z

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
上一篇下一篇

猜你喜欢

热点阅读