Skip to content

Instantly share code, notes, and snippets.

@Karytonn
Last active Oct 20, 2021
Embed
What would you like to do?
Find out which element is creating horizontal scroll?

Find out which element is creating horizontal scroll?

Run the following code in your browser console to find out who is at fault:

let width = document.documentElement.offsetWidth;

[].forEach.call(
  document.querySelectorAll('*'),
  function(el) {
    if (el.offsetWidth > width) {
      console.log(el);
    }
  }
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment