Skip to content

Instantly share code, notes, and snippets.

@Karytonn
Last active October 20, 2021 15:46
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Karytonn/eab4b1dd7a18fb7b8b5e429636f27282 to your computer and use it in GitHub Desktop.
Save Karytonn/eab4b1dd7a18fb7b8b5e429636f27282 to your computer and use it in GitHub Desktop.
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