J.Beck
0
Q:

how get height elemnt with that margin in js

//get the margin of an element,
// {{ use the getComputedStyle() method  }}
let box = document.querySelector('div');  // my div
let style = getComputedStyle(box);        // my div style


// all side margin
let marginLeft = parseInt(style.marginLeft);
let marginRight = parseInt(style.marginRight);
let marginTop = parseInt(style.marginTop);
let marginBottom = parseInt(style.marginBottom);
0

New to Communities?

Join the community