这些高度相信很多同学都搞不清楚吧.这里我通过本地测试,发现了区别. 以聊天窗口为例. 元素(class='content')高度444px,其中上下padding分别是10px,margin为0.距离最近的一个定位的父元素的上边距是60px. 这里,在控制台打印出各个高度值: var c =document.getElementsByClassName('content')[0]; console.log(c.offsetTop,c.offsetHeight,c.clientHeight,c.s…
clientheight clientheigh: 内容的可视区域,不包含border. clientheight=padding + height - 横向滚动轴高度. The Element.clientHeight read-only property is zero for elements with no CSS or inline layout boxes, otherwise it’s the inner height of an element in pixels, includ…
scrollHeight : It includes the element's padding, but not its border or margin.This property will round the value to an integer. If you need a fractional value, use Element.getBoundingClientRect(). scrollLeft: http://runjs.cn/code/szgoses4 scrollBo…