Skip to content

Instantly share code, notes, and snippets.

@imfromio
Created November 21, 2022 16:35
Show Gist options
  • Save imfromio/c1d3f9da93e6aa49230c6d16bd18adf1 to your computer and use it in GitHub Desktop.
Save imfromio/c1d3f9da93e6aa49230c6d16bd18adf1 to your computer and use it in GitHub Desktop.
Find horizontal overflowing element in browser
/* add code below to Chrome inspector Console tab */
var all = document.getElementsByTagName("*"), i = 0, rect, docWidth = document.documentElement.offsetWidth;
for (; i < all.length; i++) {
rect = all[i].getBoundingClientRect();
if (rect.right > docWidth || rect.left < 0){
console.log(all[i]);
all[i].style.borderTop = '1px solid red';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment