html · level 1 · unit 3 · lesson 2
- meet it
- guess first
- your turn
- fix it
- nailed it
Tap a green word if you get lost.
meet it
<img> puts a picture on the page.
An is a picture on your page, like a photo or a drawing. Add one with the <img> tag. It is an empty element, like <br>, so it has no closing tag.
The src attribute, short for source, names the picture to show. Each picture is saved as a with its own name, such as cat.svg. Spell it exactly, ending and all.
Pictures sit in a line like words do. Put two side by side and, if there is room, they stay on the same line.
<h2>Meet Whiskers</h2>
<img src="cat.svg"> Press show my page to see it here.
Every picture also needs words for people who cannot see it. That is the next lesson.
guess first
Two pictures. Where will they go?
Guess before you run it. Wrong guesses are how you learn, and nothing is marked.
<img src="dog.svg">
<img src="cat.svg">
your turn
Your turn. Pick a picture for a party invite.
Type one of these file names in the blank: cake.svg, ball.svg, tree.svg, cat.svg or dog.svg. Then press run.
Press show my page to see it here.
- the picture is one of the filesnot checked yet
fix it
The cake will not show. Can you fix it?
Press show my page to see it here.
- the picture's file is
cake.svgnot checked yet
- No cake appears. Is the file name complete?
- A file name has an ending after a dot. This picture's file ends in
.svg. - Change
caketocake.svg, then press run.
nailed it
your page has pictures now. :D
<img>shows a picture and has no closing tag.srcnames the picture file to show.- File names need their ending, like
.svg.
new words in your collection
- image
- file
This lesson isn’t saved. A free account remembers every lesson you finish.