Last active
January 11, 2023 10:19
-
-
Save devzom/8698c115adb8a02e6ac0504fe38219fd to your computer and use it in GitHub Desktop.
CSS: check and list all overflow'ed HTML elements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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