Skip to content

Instantly share code, notes, and snippets.

@devzom
Last active January 11, 2023 10:19
Show Gist options
  • Save devzom/8698c115adb8a02e6ac0504fe38219fd to your computer and use it in GitHub Desktop.
Save devzom/8698c115adb8a02e6ac0504fe38219fd to your computer and use it in GitHub Desktop.
CSS: check and list all overflow'ed HTML elements
// this snippets allow to list all of the elements which overflow page and is wider than HTML <body/>
var docWidth = document.documentElement.offsetWidth;
[].forEach.call(
document.querySelectorAll('*'),
(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