📌  相关文章
📜  javascript 获取 div 的宽度 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:59.405000             🧑  作者: Mango

代码示例3
// Get Content + Padding + Border
let box = document.querySelector('div');
let width = box.offsetWidth;
let height = box.offsetHeight;

// Get Content + Padding only
let box = document.querySelector('div');
let width = box.clientWidth;
let height = box.clientHeight;