Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
which elements are wider than the viewport?
var list = [];
document.querySelectorAll("body *")
if(elem.getBoundingClientRect().width > document.body.getBoundingClientRect().width){
list.push(elem.outerHTML.split('>')[0] + '>');
confirm( "these elements are wider than the viewport:\n\n " + list.join("\n") )
Copy link

BethuelHeldt commented Dec 24, 2020

Thank you... Really helpful script for my students.

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