Ship tips

May 10, 2024 (1mo ago)

Hidden Horizontal Overflow

In some cases, there might be an element that is literally wider than the document is, which might cause horizontal overflow scrolling. You could use a little JavaScript to help you find the culprit.

const documentWidth = document.documentElement.offsetWidth;
document.querySelectorAll('*').forEach((node) => {
  if (node.offsetWidth > documentWidth) {
    console.log(node);
  }
});