clientHeight & clientWidth & offsetHeight & offsetWidth

MDN

https://developer.mozilla.org/zh-CN/docs/Web/API/Window/getComputedStyle

clientHeight & clientWidth

https://developer.mozilla.org/en-US/docs/Web/API/Element/clientHeight

https://developer.mozilla.org/en-US/docs/Web/API/Element/clientWidth

https://developer.mozilla.org/zh-CN/docs/Web/API/Element/scrollHeight

offsetHeight & offsetWidth

https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight

https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetWidth



var clientHeight = document.getElementById('myDiv').clientHeight; // or var offsetHeight = document.getElementById('myDiv').offsetHeight;

outerWidth & innerWidth & outerWidth & outerHeight

window 1366x768


// 屏幕宽高
window.outerWidth;
// 1366
window.outerHeight;
// 728 === 768 - 40 // 实际宽高
window.innerWidth;
// 974 / 1366
window.innerHeight;
// 657 / 270 document.documentElement.clientWidth;
// 957 / 1349
document.documentElement.clientHeight;
// 657 / 270
document.documentElement.scrollHeight;
// 4482 / 2893 document.body.clientHeight;
document.body.offsetHeight;
document.body.scrollHeight;
// 4638 / 3485 document.body.clientWidth;
document.body.offsetWidth;
document.body.scrollWidth;
// 957 / 1349

var body = document.body,
html = document.documentElement; var height = Math.max(
body.scrollHeight,
body.offsetHeight,
html.clientHeight,
html.scrollHeight,
html.offsetHeight
);

screen.height && screen.width

https://www.cnblogs.com/xgqfrms/p/10362497.html

clientHeight & clientWidth & offsetHeight & offsetWidth & outerWidth & innerWidth & outerWidth & outerHeight的更多相关文章

  1. js中clientWidth, scrollWidth, innerWidth, outerWidth,offsetWidth的区别

    js中clientWidth, scrollWidth, innerWidth, outerWidth,offsetWidth的属性汇总,测试浏览器:ie7~ie11.chrome 和 firefox ...

  2. 四种浏览器对 clientHeight、offsetHeight、scrollHeight、clientWidth、offsetWidth 和 scrollWidth 的解释差异

    网页可见区域宽:document.body.clientWidth 网页可见区域高:document.body.clientHeight 网页可见区域宽:document.body.offsetWid ...

  3. javascript 中 offsetWidth,clientWidth;offsetHeight,clientHeight的区别

    javascript 中 offsetWidth 是对象的可见宽度,包滚动条等边线,会随窗口的显示大小改变 clientWidth.offsetWidth.clientHeight区别IE6.0.FF ...

  4. JavaScript--clientX,clientY、pageX,pageY、offsetLeft,offsetTop/offsetWidth,offsetHeight、scrollLeft,scrollTop/scrollWidth,scrollHeight、clientHeight,clientWidth区别

    /*在事件的内部console.dir(event)*/ /** * 事件对象event * clientX/clientY 获取鼠标基于浏览器窗口(可视区域的坐标位置)全兼容 * * pageX/p ...

  5. jquery width(), innerWidth(), outerWidth() 区别

    #div1 { width: 100px; height: 100px; border: 5px black solid; padding: 10px; margin: 10px; backgroun ...

  6. jquery中innerwidth,outerwidth,outerwidth和width的区别

    在jQuery中,width()方法用于获得元素宽度: innerWidth()方法用于获得包括内边界(padding)的元素宽度, outerWidth()方法用于获得包括内边界(padding)和 ...

  7. jQuery中【width(),innerWidth(),outerWidth()】

    这个问题,已经别扭我多年了,今天终于彻底解决了,拿出来庆贺一下.jquery作为开源项目,无论从思路上,还是从严谨性上,让人崇敬. 随着时间的流逝,jquery的一些功能被逐渐挖掘出来.通过jQuer ...

  8. innerWidth outerWidth

    在jQuery中: 一.width()方法用于获得元素宽度: 二.innerWidth()方法用于获得包括内边界(padding)的元素宽度; 三.outerWidth()方法用于获得包括内边界(pa ...

  9. jquery中innerWidth(),outerWidth(),outerWidth(true)和width()的区别

    jquery中innerWidth(),outerWidth(),outerWidth(true)和width()的区别 var a = 元素本身的宽度: width() = a: innerWidt ...

随机推荐

  1. hdu_3123_GCC

    The GNU Compiler Collection (usually shortened to GCC) is a compiler system produced by the GNU Proj ...

  2. JDBC配置文件db.properties(Mysql) 及dbutils的编写

    #数据库驱动driver=com.mysql.jdbc.Driver#数据库连接url=jdb:mysql://localhost:3306/newdb3?useUnicode=true&ch ...

  3. PHP+Mysql注入防护与绕过

    今天给大家分享一个关于php常见的注入防护以及如何bypass的文章,文章内容来源国外某大佬总结,我做了一下整理,文章来源地址不详,下面正文开始.以下的方式也仅仅是针对黑名单的过滤有一定的效果,为了安 ...

  4. 首层nginx 传递 二级代理,三级代理......多级代理nginx 客户端真实IP的方法

    首层nginx(172.25.10.1):先获取真实IP($remote_addr),再将真实IP传递给X-Forwarded-For    proxy_set_header X-Real-IP $r ...

  5. symfony 安装使用(一)

    Symfony安装教程网上已经存在很多了,但是这里还是要写一下: 1.symfony 安装有以下几种,对应不同的环境 1.1通过composer 命令安装 composer create-projec ...

  6. YII2.0学习二 安装adminlte 后台模板

    控制台切换到安装目录wwwroot/shanghai/ 修改一下composer镜像地址:composer 使用中国镜像 运行 composer require dmstr/yii2-adminlte ...

  7. BGP(边界网关协议)简述

    BGP的起源 不同自治系统(路由域)间路由交换与管理的需求推动了EGP的发展,但是EGP的算法简单,无法选路,从而被BGP取代. 自治系统:(AS) IGP:自治系统内部协议,ospf,rip,is- ...

  8. C 二维指针难点详解。

    关于   指向二维数组的指针. int  a[2][3]; int *p; int (*p_1)[3]; 可以用p_1 = a ,但是不能用p = a : 因为此时数组a的数据类型是  int (* ...

  9. laravel读excel

    fileName = "test.xls";$filePath = "../storage/app/";Excel::load($filePath.$fileN ...

  10. 【C#】 RBAC 权限框架

    [C#] RBAC 权限框架 一. 名词解释 1. 用户 : 登录的账号, 和角色挂钩,可拥有多个角色 2. 角色 : 账号所属的角色, 和权限挂钩,可拥有多个权限 3. 权限 : 角色拥有的操作权限 ...