What is a Fallback Image?
A fallback image is the picture shown when the preferred one cannot be: because the file is missing, the format is not supported, or a video has not loaded yet.
How Fallback Images work
There are three common cases. For newer formats, the <picture> element lists options such as AVIF and WebP, and the browser falls back to the plain <img> inside it when it supports none of them. For missing files, an error handler on the <img> can swap in a placeholder. For video, the poster attribute shows a still image until playback starts.
Key facts
<picture><source srcset="photo.avif" type="image/avif"><img src="photo.jpg" alt="A red bicycle"></picture>serves AVIF where it is supported and JPEG everywhere else.- In a JavaScript
errorhandler, replacesrconly once. If the placeholder is missing too, the handler would otherwise loop forever. - The
alttext is a separate, last fallback: it is shown in place of an image that fails to load, and screen readers read it either way.
When Fallback Images matter
Add fallbacks wherever a broken image would hurt: user avatars, product photos, and video players before playback. Give the fallback the same dimensions as the real image so the layout does not shift.