Skip to content

Instantly share code, notes, and snippets.

@LucaRosaldi
Last active February 24, 2022 10:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LucaRosaldi/a4bc1c63344286957c9e1f50d1345cef to your computer and use it in GitHub Desktop.
Save LucaRosaldi/a4bc1c63344286957c9e1f50d1345cef to your computer and use it in GitHub Desktop.
JS: Paste in console to show elements which overflow the viewport horizontally.
/* Paste this snippet in the console */
var docWidth = document.documentElement.offsetWidth;
[].forEach.call(
document.querySelectorAll('*'),
function(el) {
if (el.offsetWidth > docWidth) {
console.log(el);
}
}
);
@alirafique99
Copy link

Great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment