Explore Bato Web Agency Webflow Certified Partner Profile Explore Bato Web Agency Webflow Certified Partner Profile

How do you debug horizontal overflow in mobile Safari?

Illustration without a description Illustration without a description

Debug mobile Safari overflow on the real iPhone with Web Inspector because desktop resizing can miss WebKit-specific sizing and toolbar behavior. Start at the page root and identify the first element whose right edge exceeds the layout viewport. Fix the oversized element instead of hiding horizontal overflow on the document.

 

[…document.querySelectorAll('body *')].filter((element) => {
const rect = element.getBoundingClientRect();
return rect.left < 0 || rect.right > document.documentElement.clientWidth;
});

 

Inspect computed width, min-width, margins, transforms and positioned offsets on each result. Common causes include width: 100vw inside a padded container, unbreakable text, fixed-width media, flex children without min-width: 0, and absolute decoration translated beyond the page edge.

 

Pseudo-elements do not appear as separate query results, so check ::before and ::after on suspicious parents. Box shadows usually do not create scrollable overflow, while transforms and positioned content can. Temporarily outline all elements and disable candidate rules one at a time until the page width returns to the viewport.

 

Safari may expose the defect only with the address bar in a certain state, after rotation or at text zoom. Test both orientations and scroll enough to expand and collapse browser chrome. Inspect visual and layout viewport widths if a fixed overlay is involved, and account for safe-area padding around edge controls.

 

Avoid leaving overflow-x: hidden on body as the only repair. It can clip focus outlines, menus and intentionally scrollable tables while the underlying width remains wrong. Add localized overflow to a table or carousel that genuinely needs horizontal scrolling, then confirm the main document reports the expected scrollWidth.