height、clientHeight、offsetHeight、scrollHeight、height()、 innerHeight()、outerHeight()等的区别
1.height
height是css属性,这个属性定义元素内容区的高度,在内容区外面可以增加内边距、边框和外边距。
当 box-sizing: content-box 时,高度应用到元素的内容框。
当 box-sizing:border-box时,高度包含了内容框、内边距和边框。
2.clientHeight
Element.clientHeight只读属性是没有的CSS或内联布局框元素为零,否则它的像素单元内的高度,但不包括填充水平滚动条的高度,边界或边缘。
// 包含元素的content+padding
dom.clientHeight
3.offsetHeight
Element.offsetHeight只读属性是元素包括垂直边距和边框的高度,为整数。
// 包含元素的content+padding+border
dom.offsetHeight
4.scrollHeight
Element.scrollHeight只读属性是测量一个元素的含量的高低,包括内容不可见的屏幕上由于溢出。
// 滚动高度
dom.scrollHeight

5.jQuery height()
height() 方法设置或返回元素的高度(不包括内边距、边框或外边距)。
6.jQuery innerHeight()
innerHeight() 方法返回元素的高度(包括内边距)。
7.jQuery outerHeight()
outerHeight() 方法返回元素的高度(包括内边距和边框)。
outerHeight(true) 方法返回元素的高度(包括内边距、边框和外边距)。
参考api:https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight
参考文章:https://www.cnblogs.com/yuteng/articles/1894578.html
height、clientHeight、offsetHeight、scrollHeight、height()、 innerHeight()、outerHeight()等的区别的更多相关文章
- clientHeight ,offsetHeight,style.height,scrollHeight有区别与联系
style.height 包括 元素的滚动条,不包括边框clientHeight 不包括元素的滚动条和边框,只有在没有元素的滚动条的情况下,style.height相等于clientHeightoff ...
- 关于height、offsetheight、clientheight、scrollheight、innerheight、outerheight的区别一览
平时,不管在pc端页面还是移动端页面,因为我们一般很少会设置某个块的的高度,但是呢,我有时候有需要取到这些高度以便于我们方便进行判断和下一步的编写.一般这个时候我都是直接的获取一个块的高度.heigh ...
- clientHeight & offsetHeight & scrollHeight
clientHeight & offsetHeight & scrollHeight scrollWidth/scrollHeight,offsetWidth/offsetHeight ...
- 关于height、offsetheight、clientheight、scrollheight、innerheight、outerheight的区别
二.也是平时经常用到的offsetheight 它返回的高度是内容高+padding+边框,但是注意哦,木有加margin哦,当然一般也木有啥需要把margin加进去的,以上代码为例,结果显示上图h2 ...
- javascript - 所有的视图属性和方法(offsetHeight、clientHeight、scrollHeight、innerHeight等)
注意:本文只简单的介绍了各个视图的属性和方法.如果想要知道兼容性或者更多,请至文章底部参考链接处. 本文内容分为五大部分: Window视图属性 innerHeight 和 innerWidth ou ...
- JavaScript获取浏览器高度和宽度值(documentElement,clientHeight,offsetHeight,scrollHeight,scrollTop,offsetParent,offsetY,innerHeight)
IE中: document.body.clientWidth ==> BODY对象宽度 document.body.clientHeight ==> BODY对象高度 document.d ...
- clientHeight,offsetHeight,scrollHeight迷一样的三个值
https://blog.csdn.net/qq_39083004/article/details/78498178 https://www.imooc.com/article/17571 推荐 o ...
- 关于body/documentElement ---->clientHeight, offsetHeight, scrollHeight
http://blog.csdn.net/woxueliuyun/article/details/8638427 http://blog.sina.com.cn/s/blog_9dd702d50101 ...
- 各种高度的区别及height、clientHeight、scrollHeight、offsetHeight的区分
1.height.clientHeight.scrollHeight.offsetHeight 我们来实现test中的onclick事件 function justAtest() { ...
- height、clientHeight、scrollHeight、offsetHeight区别
转自 http://www.cnblogs.com/yuteng/articles/1894578.html 我们来实现test中的onclick事件 function justAtest() ...
随机推荐
- [转帖]2015年时微软Win3.1崩溃迫使巴黎奥利机场短暂关闭
https://www.ithome.com/html/it/188796.htm IT之家讯 2015年11月14日消息,上周法国巴黎奥利机场因为微软的Windows 3.1系统出现故障不得不迫使所 ...
- Day 5-6 反射和内置方法之item系列
python面向对象中的反射:通过字符串的形式操作对象相关的属性.python中的一切事物都是对象(都可以使用反射) #!_*_ coding:utf-8 _*_ class People: def ...
- 前端开发之css
<!--页面中的组成部分通常随便打开一个网页,有文字,图片,视频,表格,音频,表单(注册信息) css 属性/尺寸/边框/背景 1.css的尺寸属性,就是大小width max-width mi ...
- WPF通过DynamicResource实现给界面动态更换皮肤
在我们的程序中有时候需要去实现动态更换皮肤的效果,从而完成一些个性化的设置,那么我们究竟怎样去实现动态换皮肤的效果呢?那么我们经常用到的就是设置不同的Style,并且在主程序的xaml文件中通过Dyn ...
- DAY07、字符编码和文件操作
一.字符编码 1.什么是字符编码? 人类能识别的是字符等高级标识符,电脑只能识别0,1组成的标识符,要完成人与机器之间的信息交流, 一定需要一个媒介,进行两种标识符的转化(两 ...
- 在IWMS中的分页效果
第一步,你需要在后台修改你所要显示的新闻数目: 第二步,你需要把这段代码加到你需要分页的列表里边 代码: <%=config.TopAd%><asp:Literal id=" ...
- 莫烦theano学习自修第四天【激励函数】
1. 定义 激励函数通常用于隐藏层,是将特征值进行过滤或者激活的算法 2.常见的激励函数 1. sigmoid (1)sigmoid() (2)ultra_fast_sigmoid() (3)hard ...
- Scrapy网络爬虫框架的开发使用
1.安装 2.使用scrapy startproject project_name 命令创建scrapy项目 如图: 3.根据提示使用scrapy genspider spider_name dom ...
- Python学习之路——Day06 元组
一.元组 t1 = (1, 2) t2 = tuple((1, 2)) t3 = (1, ) # 索引 | 切片 | 长度 # .count(obj) | .index(obj, bIndex, eI ...
- servlet篇 之servlet实现
一:如何写一个servlet 实现/继承 如下 接口/类 Servlet 接口 有五个抽象方法 GenericServlet 抽象类 有一个抽象方法 HttpServlet 抽象类 ...