clientHeight offsetHeight scrollHeight
来源:互联网 发布:热处理工艺模拟软件 编辑:程序博客网 时间:2024/06/05 16:43
参考文章:http://blog.csdn.net/magic232/article/details/20443839
clientHeight
大部分浏览器对 clientHeight 都没有什么异议,都认为是内容可视区域的高度,也就是说页面浏览器中可以看到内容的这个区域的高度,即然是指可看到内容的区域,滚动条不算在内。但要注意padding是算在内。其计算方式为clientHeight = topPadding + bottomPadding+ height - scrollbar.height。
offsetHeight
在IE6,IE7,IE8以及最新的的FF, Chrome中,在元素上都是offsetHeight = clientHeight + 滚动条 + 边框。
scrollHeight
scrollHeight是元素的padding加元素内容的高度。这个高度与滚动条无关,是内容的实际高度。
计算方式 :scrollHeight = topPadding + bottomPadding + 内容 box的高度。
这里的scrollHeight的计算方式是基于内层元素的box定义的高度小于外层元素的height得到的,而内容box指的是子元素的box,包括margin,padding,border和height
最新的主流浏览器都认为scrollHeight的最小高度为clientHeight。
如果内层元素的box定义的高度大于外层元素的height,则分成下面两种情况:
一是overflow为scroll或者hidden,scrollHeight=topPaffinh+内容box的高度
二是overflow为visible或未定义overflow,可以设置三个嵌套div验证。
注:对于documentElement来说,offsetHeight为body的offsetHeight+margin,而与documentElement的clientHeight无关。
- clientHeight、offsetHeight和scrollHeight
- 关于clientHeight、offsetHeight、scrollHeight
- 关于clientHeight、offsetHeight、scrollHeight
- clientHeight offsetHeight scrollHeight区别
- clientHeight、offsetHeight和scrollHeight
- 关于 clientHeight 、offsetHeight 、scrollHeight
- clientHeight、offsetHeight、scrollHeight
- 关于clientHeight、offsetHeight、scrollHeight
- clientHeight、offsetHeight和scrollHeight
- scrollHeight, clientHeight, offsetHeight 差别
- clientHeight、offsetHeight 和 scrollHeight
- clientHeight,offsetHeight,scrollHeight区别
- 关于clientHeight、offsetHeight、scrollHeight
- 关于clientHeight、offsetHeight、scrollHeight
- clientHeight、offsetHeight 和 scrollHeight
- 关于clientHeight、offsetHeight、scrollHeight
- clientHeight、offsetHeight 和 scrollHeight
- clientHeight、offsetHeight和scrollHeight
- 函数指针
- onCreate中的savedInstanceState有何具体作用
- 使用Jquery--Jsp与servlet之间的数据交互
- 六大设计原则(一)单一职责原则、里氏替换原则
- Redis学习1_Redis快速入门
- clientHeight offsetHeight scrollHeight
- POJ 1346--King 【差分约束】
- ZOJ 2967——Colorful Rainbows
- Android中app卡顿原因分析(ios顺滑)
- hadoop之MapReduce调用R的一次失败的总结~(续四)
- Windows7设置系统自动开机输入密码
- iOS Sprite Kit教程之场景的设置
- Android-Toolbar 使用
- OpenGL版本