Make a class media gallery

Arrange a photo, a GIF and a short video in a responsive CSS grid.

What you’ll learn

Create a gallery with useful photo descriptions, captions and player controls.

Before you start

Open the gallery example. The media files are included, so you can run it after offline preparation.

Steps

  1. Open index.html. Change one <figcaption> and describe the image in its alt attribute.
  2. In style.css, find grid-template-columns. The 15rem value is the preferred minimum card width. Try 18rem and compare how many cards fit.
  3. Press Run. Check whether the GIF moves and the video plays and seeks. Export a ZIP to keep the page and media together.

Expected result

The gallery fits the available width and each file loads from the local project.

Common mistakes

If an image is blank, compare its src with the exact name in the media folder. Use controls on the video so the reader can start it.