how get height elemnt with that margin in js

Solutions on MaxInterview for how get height elemnt with that margin in js by the best coders in the world

showing results for - "how get height elemnt with that margin in js"
Alessio
14 Feb 2016
1//get the margin of an element,
2// {{ use the getComputedStyle() method  }}
3let box = document.querySelector('div');  // my div
4let style = getComputedStyle(box);        // my div style
5
6
7// all side margin
8let marginLeft = parseInt(style.marginLeft);
9let marginRight = parseInt(style.marginRight);
10let marginTop = parseInt(style.marginTop);
11let marginBottom = parseInt(style.marginBottom);