Command Palette

Search for a command to run...

Hectal
Phase 5: Media and Embeds
HTML · Exercise 2 of 6 PreviousNext
Intermediate

Let the browser pick the size

This article photo exists in three widths: photo-400.jpg (400px wide), photo-800.jpg (800px) and photo-1600.jpg (1600px). It fills the screen on phones up to 600px wide and half the screen on anything wider.

Add a srcset listing the three files with w descriptors, and a sizes that describes that layout. Keep photo-800.jpg as the src fallback.

The files don't exist in this sandbox, so the preview shows the alt text. That's fine: the checks read your attributes.

What Check tests

  1. srcset lists the three files with their widths (400w, 800w, 1600w)
  2. sizes says 100vw up to 600px wide
  3. sizes says 50vw otherwise
  4. The src fallback and alt text are still there

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.