1var width = document.getElementById('myID').offsetWidth;//includes margin,border,padding
2var height = document.getElementById('myID'). offsetHeight;//includes margin,border,padding
1//includes margin and padding
2document.getElementById('myDiv').offsetHeight;
3//without margin and padding
4document.getElementById('myDiv').clientHeight;
1// Get Content + Padding + Border
2let box = document.querySelector('div');
3let width = box.offsetWidth;
4let height = box.offsetHeight;
5
6// Get Content + Padding only
7let box = document.querySelector('div');
8let width = box.clientWidth;
9let height = box.clientHeight;