1.元素尺寸
- offsetheight offsetwidth - 边框+内间距+内容区域
var box=document.querySelector(".box");
console.log(box.offsetWidth);
console.log(box.offsetHeight);
输出结果:
- clientwidth clientheight - 内间距+内容区域
console.log(box.clientHeight);
console.log(box.clientWidth);
输出结果: