Skip to content

Instantly share code, notes, and snippets.

@marcus-grant
Created November 15, 2020 22:57
Show Gist options
  • Save marcus-grant/4ceec56b91c409df2ccfee1621b1fe4c to your computer and use it in GitHub Desktop.
Save marcus-grant/4ceec56b91c409df2ccfee1621b1fe4c to your computer and use it in GitHub Desktop.
JS snippet that when put in devtools console will find horizontally overflowing elements
var docWidth = document.documentElement.offsetWidth;
[].forEach.call(
document.querySelectorAll('*'),
function(el) {
if (el.offsetWidth > docWidth) {
console.log(el);
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment