Pair an image with a caption that everyone can read.
What to build
A figure with an image and a caption.
Requirements
- A
figurecontaining animgand afigcaption. - The image has
src="river.jpg", non-empty alt text, and width and height. - The
figcaptionreadsThe Padma at sunset. - The image has
loading="lazy".
Constraints
The img must be inside the figure, not next to it.
Example
The caption appears under the image, because figcaption follows it.
Why it works
figure tells the browser and assistive technology that the caption belongs to this particular image.
Hints
Hint 1
figure contains both the img and the figcaption.
Hint 2
The caption is different from the alt text. A caption is visible to everyone.
Solution
Show one correct solution (try it yourself first)
<h1>Rivers of Bangladesh</h1> <figure> <img src="river.jpg" alt="A wide river glowing orange at sunset" width="600" height="400" loading="lazy"> <figcaption>The Padma at sunset</figcaption> </figure>