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()等的区别的更多相关文章

  1. clientHeight ,offsetHeight,style.height,scrollHeight有区别与联系

    style.height 包括 元素的滚动条,不包括边框clientHeight 不包括元素的滚动条和边框,只有在没有元素的滚动条的情况下,style.height相等于clientHeightoff ...

  2. 关于height、offsetheight、clientheight、scrollheight、innerheight、outerheight的区别一览

    平时,不管在pc端页面还是移动端页面,因为我们一般很少会设置某个块的的高度,但是呢,我有时候有需要取到这些高度以便于我们方便进行判断和下一步的编写.一般这个时候我都是直接的获取一个块的高度.heigh ...

  3. clientHeight & offsetHeight & scrollHeight

    clientHeight & offsetHeight & scrollHeight scrollWidth/scrollHeight,offsetWidth/offsetHeight ...

  4. 关于height、offsetheight、clientheight、scrollheight、innerheight、outerheight的区别

    二.也是平时经常用到的offsetheight 它返回的高度是内容高+padding+边框,但是注意哦,木有加margin哦,当然一般也木有啥需要把margin加进去的,以上代码为例,结果显示上图h2 ...

  5. javascript - 所有的视图属性和方法(offsetHeight、clientHeight、scrollHeight、innerHeight等)

    注意:本文只简单的介绍了各个视图的属性和方法.如果想要知道兼容性或者更多,请至文章底部参考链接处. 本文内容分为五大部分: Window视图属性 innerHeight 和 innerWidth ou ...

  6. JavaScript获取浏览器高度和宽度值(documentElement,clientHeight,offsetHeight,scrollHeight,scrollTop,offsetParent,offsetY,innerHeight)

    IE中: document.body.clientWidth ==> BODY对象宽度 document.body.clientHeight ==> BODY对象高度 document.d ...

  7. clientHeight,offsetHeight,scrollHeight迷一样的三个值

    https://blog.csdn.net/qq_39083004/article/details/78498178 https://www.imooc.com/article/17571  推荐 o ...

  8. 关于body/documentElement ---->clientHeight, offsetHeight, scrollHeight

    http://blog.csdn.net/woxueliuyun/article/details/8638427 http://blog.sina.com.cn/s/blog_9dd702d50101 ...

  9. 各种高度的区别及height、clientHeight、scrollHeight、offsetHeight的区分

    1.height.clientHeight.scrollHeight.offsetHeight 我们来实现test中的onclick事件    function justAtest()    {    ...

  10. height、clientHeight、scrollHeight、offsetHeight区别

    转自 http://www.cnblogs.com/yuteng/articles/1894578.html 我们来实现test中的onclick事件    function justAtest()  ...

随机推荐

  1. PL/SQL如何调试sql语句、存储过程

    一直以来,我总是在sql的工具,比如sql server.navicat等中执行sql语句来发现问题自己写的sql中的问题,结果被问起时,让人贻笑大方! 那么如何调试成白行的存储过程?如何调试成百行s ...

  2. MyBaits全局配置文件的各项标签1

    ■dtd约束     <!DOCTYPE configuration           PUBLIC "-//mybatis.org//DTD Config 3.0//EN" ...

  3. python爬虫之requests的基本使用

    简介 Requests是用python语言基于urllib编写的,采用的是Apache2 Licensed开源协议的HTTP库,Requests它会比urllib更加方便,可以节约我们大量的工作. 一 ...

  4. 在linux命令下访问url

    1.elinks - lynx-like替代角色模式WWW的浏览器 例如: elinks --dump http://www.baidu.com 2.wget 这个会将访问的首页下载到本地 [root ...

  5. 爬虫实战——Scrapy爬取伯乐在线所有文章

    Scrapy简单介绍及爬取伯乐在线所有文章 一.简说安装相关环境及依赖包 1.安装Python(2或3都行,我这里用的是3) 2.虚拟环境搭建: 依赖包:virtualenv,virtualenvwr ...

  6. jquery和js的几种页面加载函数的方法以及执行顺序

    参考博客:http://www.cnblogs.com/itslives-com/p/4646790.html    https://www.cnblogs.com/james641/p/783837 ...

  7. phonegap-plugin-contentsync

    一.API 1.ContentSync.sync(options) options.src : 字符串类型  (必选项)远程托管内容的URL.更新一个生产环境下的APP,常使用HTTPS option ...

  8. mybatis-spring-1.2.2.jar下载地址

    http://www.java2s.com/Code/Jar/m/Downloadmybatisspring120jar.htm

  9. Lodop打印项对象类型属性区分

    Lodop提供了一些打印项类型,默认是普通项,通过设置打印对象的类型,可以实现一些普通项不能实现的效果.例如:该博客另一篇博文 标题是Lodop打印控件 打印‘接下一页’‘以下空白’,就用了眉脚项. ...

  10. How to vi

    h:left,j:down,k:up,l:right.wq #write and quitx #cut one letterdd#cut one line/ #searchs/a/b/ #replac ...