All cases
RL-006 / Overflow & ReflowEvidence verified

Stop Fixed-Size Images From Breaking Mobile Layouts

A 640-pixel image keeps its authored width inside a narrower article, forcing the document wider even though its intrinsic aspect ratio is valid.

Experiment mode

Fixture viewport

Failingwidth: 640px
Viewport / page
--
Image
--
Page overflow
--
Fixedmax-inline-size: 100%
Viewport / page
--
Image
--
Page overflow
--

Three-browser evidence verified. Live values come from your current browser. The formal matrix records the controlled browser runs and fixture revision used for the published conclusion.

Observed failure

The authored image width is larger than its container

The image has a valid 640 by 360 intrinsic size and an explicit 640-pixel rendered width. On a narrow viewport, that width exceeds the article content box and increases the document scroll width.

Minimal code diff

Cap the image at its containing block

Keep the intended width as an upper target, add `max-inline-size: 100%`, and let the block size remain automatic so the intrinsic ratio is preserved.

Before

.article-image {
  width: 640px;
  height: auto;
}

After

.article-image {
  width: 640px;
  max-inline-size: 100%;
  block-size: auto;
}

Root cause

An image is a replaced element with intrinsic dimensions supplied by its resource. An authored fixed width can override the normal available inline size. When that width is larger than the containing block, the image itself becomes wider than the article and the page gains horizontal overflow.

The width and height attributes in the fixture communicate the intrinsic ratio before the resource loads. CSS then limits the rendered inline size while preserving automatic proportional height.

Separate intrinsic size from rendered size

Inspect naturalWidth and naturalHeight alongside the rendered rectangle and the containing block’s client width. In this fixture the 640 by 360 intrinsic dimensions are valid; the failure is that the rendered inline size is also forced to 640 pixels inside a narrower article. The fixed state keeps the intrinsic ratio metadata but caps the rendered box at the available boundary.

Test the widest real asset, a slow load, and a failed load state. Width and height attributes should reserve the correct ratio before decoding, while responsive CSS prevents overflow after decoding. Alternative text must still describe the image’s purpose, and any linked or actionable image must retain a visible focus indicator at the reduced size.

When this fix is not enough

Containment does not choose an efficient file for the device. Large production images may also need srcset, sizes, modern formats, compression, and an appropriate loading strategy. Those performance decisions are separate from ensuring the rendered box cannot exceed its content boundary.

Regression condition

At 320 and 375 CSS pixels, the failing image must create positive page-level overflow. The fixed image must remain inside the page, render narrower than its 640-pixel intrinsic width, and preserve the original 16:9 aspect ratio.

Primary references

Sources checked for this case

  1. HTML Standard - the img element - WHATWG, checked 2026-08-04
  2. Understanding Success Criterion 1.4.10: Reflow - W3C Web Accessibility Initiative, checked 2026-08-04

Formal evidence

Browser and viewport matrix

Three-browser run

Cells show failing / fixed page overflow in CSS pixels.

Browser32037576810241440
Chromium+360 / +0+305 / +0+0 / +0+0 / +0+0 / +0
Firefox+360 / +0+305 / +0+0 / +0+0 / +0+0 / +0
WebKit+360 / +0+305 / +0+0 / +0+0 / +0+0 / +0
18/18 recorded assertions passed
  • chromium-failing-overflow-320360px
  • chromium-fixed-overflow-3200px
  • chromium-fixed-image-ratio-320640x360 intrinsic, 240x135 rendered
  • chromium-failing-overflow-375305px
  • chromium-fixed-overflow-3750px
  • chromium-fixed-image-ratio-375640x360 intrinsic, 295x166 rendered
  • firefox-failing-overflow-320360px
  • firefox-fixed-overflow-3200px
  • firefox-fixed-image-ratio-320640x360 intrinsic, 240x135 rendered
  • firefox-failing-overflow-375305px
  • firefox-fixed-overflow-3750px
  • firefox-fixed-image-ratio-375640x360 intrinsic, 295x166 rendered
  • webkit-failing-overflow-320360px
  • webkit-fixed-overflow-3200px
  • webkit-fixed-image-ratio-320640x360 intrinsic, 240x135 rendered
  • webkit-failing-overflow-375305px
  • webkit-fixed-overflow-3750px
  • webkit-fixed-image-ratio-375640x360 intrinsic, 295x166 rendered