获取元素尺寸
+ 元素的占地面积
+ 占地面积: 内容区域 + padding + border

两组方式
1. offsetWidth 和 offsetHeight
+ 语法:
-> 元素.offsetWidth
-> 元素.offsetHeight
+ 得到:
-> 元素的 内容 + padding + border 区域的尺寸
+ 注意:
-> display: none 以后是 0
2. clientWidth 和 clientHeight
+ 语法:
-> 元素.clientWidth
-> 元素.clientHeight
+ 得到:
-> 元素 内容 + padding 区域的尺寸
+ 注意:
-> display: none 以后是 0

posted on 2021-07-14 16:06  phantom_yy  阅读(42)  评论(0)    收藏  举报