Add a picture properly

Add one image with all the attributes it needs.

What to build

A single image of a cat.

Requirements

  • An img with src="cat.jpg".
  • alt text containing the word cat.
  • width="300" and height="200".

Constraints

Use one img element and no closing tag.

Example

<img src="dog.jpg" alt="A dog asleep on a sofa" width="300" height="200">

Why it works

The alt text replaces the picture when it cannot be seen, and the width and height reserve its space.

Hints

Hint 1

img has no closing tag. It needs src and alt.

Solution

Show one correct solution (try it yourself first)
<img src="cat.jpg" alt="A grey cat sitting by a window" width="300" height="200">

Lesson: Images and why alt text matters →