Skip to content
engineering workbench.by StudyPort Academy
All errors
browser · DEBUG LIBRARY

The page overflows, collapses, or ignores an asset

Locate the failed assumption, reproduce it, then repair the cause.

What actually caused it

A horizontal scrollbar, a column that will not shrink, or a hole where an image should be is a layout failure with a small set of causes. content-box width plus padding is wider than the parent. A flex item or a 1fr track will not shrink below its content. An image without a maximum width, or a pre element that does not wrap, forces the page open. A missing stylesheet or image leaves the HTML in place and the presentation half-applied.

Height collapses when a parent has only absolutely positioned children, because those children are out of flow and contribute no height. Vertical margins can collapse too, so two 16px gaps become one. None of these show up as a JavaScript exception.

The Network tab tells you whether the asset arrived. The Elements tells you which layer is larger than you think. Guessing from the screenshot mixes those two different failures.

Minimal reproduction

Padding added outside a full width

.card {
  box-sizing: content-box;
  width: 100%;
  padding: 16px;
}

The border edge is wider than the parent.

A track that will not shrink

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

1fr still has an automatic minimum size.

The fix

Set border-box when the declared width should include padding and border. Give a shrinking flex item min-width: 0, and a shrinking track minmax(0, 1fr). Give images max-width: 100% and a width and height or aspect-ratio so a late file does not jump.

If the parent has no height, put something in flow or give it a definite size before you absolute-position every child. Then reload with the Network tab open and confirm the stylesheet and images returned a successful status. Fix the request that failed before you add another selector.

Include padding, and allow the track to shrink

.card {
  box-sizing: border-box;
  width: 100%;
  padding: 16px;
}
.cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}