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. Linux基础学习笔记3-用户权限

    本章内容 用户user 令牌token,identity Linux用户:Uername/UID 管理员:root,0 普通用户:1-65535 系统用户:1-499,1-999(Centos7) 对 ...

  2. python爬虫之git的使用

    一.简单认识: 1.初始化文件夹为版本控制文件夹,首先建立一个文件夹,进入这个文件夹以后输入git init初始化这个文件夹. 2.Git几种位置概念 1.本地代码:本地更改完代码以后,虽然是存放在g ...

  3. Data Structures & js &ES 6 & ES next

    Data Structures & js &ES 6 & ES next Algorithm Singly-Linked List & Doubly-Linked Li ...

  4. Java的HashMap数据结构

    标题太大~~~自己做点笔记.别人写得太好了. https://www.cnblogs.com/liwei2222/p/8013367.html HashMap 1.6时代, 使用Entry[]数组, ...

  5. Jenkins+PowerShell持续集成环境搭建(七)构建触发器

    Jenkins 有三种类型的构建触发器,如下图: Build after other projects are built:在其他项目构建后构建: Build periodically:定时构建: P ...

  6. gevent监测单线程下的io进行切换

    from gevent import monkey;monkey.patch_all() import gevent import time def eat(name): print('%s eat ...

  7. HttpWebRequest using Basic authentication

    System.Net.CredentialCache credentialCache = new System.Net.CredentialCache(); credentialCache.Add( ...

  8. codeforces581C

    Developing Skills CodeForces - 581C 你在玩一个游戏.你操作的角色有n个技能,每个技能都有一个等级ai.现在你有k次提升技能的机会(将其中某个技能提升一个等级,可以重 ...

  9. 创建iview框架的项目

    http://www.cnblogs.com/jf-67/p/8479176.html 在使用‘vue init webpack my-project’创建项目时,出现了错误 npm ERR! cod ...

  10. docker 搭建简易仓库registry

    下载仓库镜像: docker pull  registry:2 运行仓库库镜像: docker run -d  -p 5000:5000  -v /usr/local/registry:/var/li ...