Skip to content
CSS·Intermediate·Scenario based·1 min read

How would you debug unexpected overflow?

Short interview answer

Identify the overflowing element, inspect its scroll width and computed constraints, then check unbreakable content, intrinsic minimums, fixed widths, transforms, and viewport units. Hiding overflow before finding the cause can mask inaccessible content.

Example

CSS
/* quick visual audit in devtools console */[...document.querySelectorAll('*')].forEach((el) => {  if (el.scrollWidth > document.documentElement.clientWidth) console.log(el);});

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to CSS layout

Related questions