首页 > 技术文章 > scrollWidth/scrollHeight,offsetWidth/offsetHeight,clientWidth/clientHeight

acaciasun 2013-09-24 21:04 原文

scrollWidth/scrollHeight:

可滚动部分的尺寸

offsetWidth/offsetHeight:

width/height+padding+border,不包含margin

clientWidth/clientHeight:

如果当前元素是根元素(document.documentElement),这两个属性将返回window的尺寸,它们是除去滚动条及其他浏览器“包装”(Chrome)之外内部或视口的尺寸。在其他情况下,这两个属性返回元素的内容加上内边距的尺寸

width+padding,不包含scrollbar

推荐阅读