A campaign image arrives late and the copy below jumps just as someone starts reading it. The browser did not know how tall the image would be. Give it the image's width and height in the HTML, then let CSS scale the image to the available width.
Watch the difference
Save this as an HTML file and open it in a browser. Both images receive the same 1200 × 675 SVG after three seconds. The first has no dimensions; the second declares them before the image arrives. Watch the line beneath each box. Resize the browser and reload to repeat at another width.
<!doctype html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.comparison { display: flex; align-items: flex-start; gap: 1rem; }
.example { flex: 1; min-width: 0; max-width: 600px; }
img { display: block; width: 100%; height: auto; }
</style>
<div class="comparison"><div class="example">
<img id="unreserved" alt="">
<p>This line moves when the image arrives.</p>
</div>
<div class="example">
<img id="reserved" width="1200" height="675" alt="">
<p>This line already has room above it.</p>
</div></div>
<script>
const svg = '<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="675"><rect width="1200" height="675" fill="#6366f1"/></svg>';
const image = 'data:image/svg+xml,' + encodeURIComponent(svg);
setTimeout(() => {
document.getElementById('unreserved').src = image;
document.getElementById('reserved').src = image;
}, 3000);
</script>
This deliberately delays assigning the source so the before and after states are easy to see; it is a teaching fixture, not a loading strategy. The empty alt is appropriate for this decorative color block. Write meaningful alternative text for an image that conveys information.
With the example's 600 px maximum width, the reserved height is 600 × 675 ÷ 1200 = 337.5 px. At a 320 px image width it is 320 × 675 ÷ 1200 = 180 px. These are layout dimensions, not a requirement to deliver a 600 px file. The browser uses the declared ratio before loading and the intrinsic ratio once the image is available; wrong attributes can therefore still cause a shift. MDN explains the sizing behavior.
Declare the real ratio
For a real image, use its actual dimensions in the attributes. Responsive CSS changes the displayed width while preserving that ratio:
<img src="campaign-1200.jpg" width="1200" height="675"
alt="A blue campaign poster on a wall" class="campaign-image">
.campaign-image { display: block; max-width: 100%; height: auto; }
The attributes give the browser an early aspect ratio; max-width prevents overflow without forcing a small image to stretch. If the design intentionally fills a fixed-ratio slot instead, set the slot's aspect-ratio and use object-fit: cover on its image. That keeps the slot stable but crops the image: check that the campaign's subject and required copy survive.
Check art-directed sources separately
A portrait crop and a landscape crop are different ratios. If the fallback <img> declares 1200 × 675 but a mobile <source> selects 600 × 800 without its own dimensions, a 320 px-wide image may initially reserve 180 px and then need about 427 px: roughly 247 px of content movement. Give each art-directed source its own dimensions:
<picture>
<source media="(max-width: 600px)" srcset="campaign-portrait.jpg"
width="600" height="800">
<img src="campaign-landscape.jpg" width="1200" height="675"
alt="A blue campaign poster on a wall" class="campaign-image">
</picture>
The HTML Standard permits the selected <source> to supply dimensions to its <img>. Test the actual breakpoint and crops in the browsers you support, including before the image arrives. Width candidates that are simply different resolutions of the same crop should share the same ratio; sizes helps select a resource but does not repair a mismatched ratio.
Finally, reload with a throttled connection or blocked image request. The content beneath the image should stay in place as it appears. Test a failed image too, and repeat at the narrow and wide layouts where different sources are selected.