How to find items with negative margins?

I am working on a large application and am 100% sure there is an element with a negative field that collapses my content?

How can I find all elements with negative margins using JavaScript?

+4
source share
1 answer

You could just do it

var elems = document.body.getElementsByTagName("*");
for (var i = elems.length; i--;) {
    var m = window.getComputedStyle(elems[i],null).getPropertyValue("margin");
    console.log(m)
}

Here you can either study the log, or split the variables into margin.left, etc., and check if this number is not less.

+3
source

All Articles