Build an image gallery

Task

Create a simple gallery of three images, each with a meaningful alt attribute and a caption using <figure>/<figcaption>.

Requirements

  • Each image is wrapped in a <figure>
  • Each <figure> contains a <figcaption> with a caption
  • Every <img> has a meaningful alt attribute (not empty, not "image")
  • At least 3 images are used

Starter code

<div class="gallery">
</div>
▶ Open in HTML Editor

Hints

  • alt should describe what's in the image, not just repeat the file name.
  • figcaption is written inside figure, either before or after the img.
Show solution
<div class="gallery">
  <figure>
    <img src="cat.jpg" alt="Ginger cat sleeping on a windowsill">
    <figcaption>House cat</figcaption>
  </figure>
  <figure>
    <img src="mountains.jpg" alt="Mountain range at sunset">
    <figcaption>Sunset over the mountains</figcaption>
  </figure>
  <figure>
    <img src="city.jpg" alt="City at night with lit-up buildings">
    <figcaption>City in the evening</figcaption>
  </figure>
</div>

Related tools