Show a picture with the img tag, and describe it with alt for anyone who cannot see it.
Every photo, icon and logo on a website is an img tag, and its alt text is what a screen reader says aloud.
A picture is a file of its own. The page does not hold the picture: it says which file to show, and what the picture is for people who cannot see it.
Make your prediction first. Help opens once you've locked it in.
<h2>Winners</h2>
<img src="trophey.svg" alt="A gold trophy" width="100">
<p>Well done, Owls!</p>
<img> shows a picture. src names the picture file, and alt describes it. Read the code. What will the page show?
Compare the page with your prediction. The alt words show because the browser cannot find a file called trophey.svg. The table says what each part does.
| Code | What it does | Why |
|---|---|---|
<img … > |
Shows a picture | <img> has no closing tag: there are no words to wrap, so everything it needs is in its attributes |
src="trophy.svg" |
Names the picture file | The picture is a separate file. The name, the ending after the dot and the capitals must match the file exactly, or the browser cannot find it |
alt="A gold trophy" |
Says what the picture shows | Screen readers read it aloud, and the browser shows it when the picture cannot load. It is not a caption: people who can see the picture do not see it |
width="100" |
Sets the picture's width in pixels | Another attribute. Without it the picture shows at its own size |
<h2>Winners</h2>
<img src="trophey.svg" alt="A gold trophy" width="100">
<p>Well done, Owls!</p>
<h2>Winners</h2>
<img src="trophy.svg" alt="A gold trophy" width="100">
<p>Well done, Owls!</p>
Think about who needs the words.
Imagine describing the picture to someone on the phone.
One picture does not show.
The trophy shows, but the medal does not: only its alt words appear. The picture file is called medal.svg. Click the line that causes it.
Show medal.svg instead of the trophy. Only the file name changes.
The file name is the part inside the quotes after src=.
The picture to show is medal.svg. Match the name exactly.

The alt words still describe a trophy. Change them to A silver medal.
alt is the attribute with the words in quotes.
Describe the medal as you would to someone on the phone: A silver medal.

Make the picture 200 wide.
Change the number inside the quotes after width=.

Show the medal picture instead of the trophy.
This ticks when your page has all of the above.
Change the alt words to A silver medal.
This ticks when your page has all of the above.
Make the picture 200 wide.
This ticks when your page has all of the above.
Make the picture itself the thing people click.
Put the lines in order so that clicking the trophy picture opens the results. One line is not needed.
Make a page for a school club: a title, a picture, and a paragraph about when it meets. The pictures you can use are trophy.svg, medal.svg, book.svg, ball.svg, star.svg and music.svg.
Pick one picture. Its file name goes in src.
Write alt as if describing the picture to someone on the phone.

Make a club page with a title, a picture with alt, and a paragraph.
This ticks when your page has all of the above.
Students show a picture with img, and learn that src must match the file name exactly and that alt describes the picture for people who cannot see it. About 40 minutes.
Open the teacher guide: answers, solutions, slides and a worksheet.
Read the unit primer "Lists, links and pictures in 5 minutes" first, then do the Make task yourself in the playground (about 5 minutes).
An <img> tag has no closing tag, and the picture is a separate file. src names the file and alt describes it. The pictures students can use without uploading are trophy.svg, medal.svg, book.svg, ball.svg, star.svg and music.svg. Two ideas to land: a file name that is nearly right still fails, and alt is not a caption.
Believing that a nearly right file name will do. Let them see the alt words, then ask what the browser can compare the name to.
Stretch: Add a second picture with its own alt, and make one of the pictures a link to a page.
Support: Give students the Modify starter and do the first task together, then change the alt words and the width.
Next lesson names some of the elements with a class so that a CSS rule can style only those. Class idea: ask what a person using a screen reader hears when the alt says image.