LESSON 35 OF 120

Build: a responsive picture

Provide an alternative source and fallback img inside picture.

Official sourceWHATWG HTML — pictureReviewed: 2026-08-26
STEP 1 · LEARN

How it works

Provide an alternative source and fallback img inside picture. Semantic structure should describe meaning, not visual appearance.

Correct example
<picture><source media="(min-width: 800px)" srcset="landscape-wide.webp"><img src="landscape.jpg" alt="Landscape at sunset"></picture>

picture lets the browser choose an appropriate source. The img remains the required fallback and keeps the alternative text.

Common mistake
<picture><source srcset="landscape-wide.webp"></picture>

The fallback img is missing. If the source cannot be selected or loaded, picture provides neither the default image nor alt text.

STEP 2 · APPLY

Your exercise

Complete the example. Provide an alternative source and fallback img inside picture.

STEP 3 · BUILD

Write and see the result

index.htmlHTML
Safe resultisolated
The draft stays only in this browser.HTML and CSS allowed · scripts and network blocked
STEP 4 · CHECK

What needs to pass

0%not checked
  • picture has a source with srcset.
  • picture keeps a fallback img.
Explain the solution logic

Place source before the image and add a complete img with src and alt at the end.