Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alexstandiford/fcf262fd35ab2361a145a7e17e5d5313 to your computer and use it in GitHub Desktop.
Save alexstandiford/fcf262fd35ab2361a145a7e17e5d5313 to your computer and use it in GitHub Desktop.
Overflow helper bookmarklet
javascript:(function(){ const outline = document.querySelector('.outline-everything-with-red'); if(!outline){ style = document.createElement('style'); style.classList.add('outline-everything-with-red'); style.appendChild(document.createTextNode('* {outline: 1px solid red;}')); document.head.appendChild(style); console.log('The following elements appear to be wider than the document.'); [].forEach.call( document.querySelectorAll('*'), function(el) { if (el.offsetWidth > docWidth) { console.log(el); } } ); } else{ outline.remove(); } var docWidth = document.documentElement.offsetWidth; })()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment