Images (img, src, alt), online

Six activities your students do on their own devices. See who's finished, and their scores.

Images (img, src, alt) in one minute

What students need to know

alt="Company logo" describes the image. Screen readers announce this text to visually impaired users. src="banner.jpg" tells the browser which file to load. alt="Banner" describes it for accessibility.

<img> is self-closing. It has no content and no closing tag - adding </img> is invalid HTML. src provides the image path on <img>. href is used on <a> elements for link destinations.

Mistakes students make

  • The <img> tag is missing the required alt attribute. Always include alt="description" for accessibility and fallback text.
  • The alt value must be enclosed in double quotes: alt="Hero banner", not alt=Hero banner without quotes.
  • The alt attribute must be inside the <img> opening tag, not on a separate line. Write: <img src="sunset.jpg" alt="Sunset view">.
  • <image> is not a valid HTML element. The correct self-closing element for images is <img>.

Discover other journeys with this module

What students will learn in this module

Every question in Module 17

Quick questions

  1. True or false: <img> needs a closing </img> tag.AFalseBTrue
  2. Which attribute specifies the image file to display?AsrcBhref
  3. What is the purpose of the alt attribute on an <img>?ASets the caption displayed below the imageBProvides text shown if the image fails and read by screen readers
  4. True or false: it is acceptable to omit alt on an <img>.ATrueBFalse
  5. True or false: <IMAGE src="x.jpg"> is valid HTML.AFalseBTrue

Key terms

Students type the meaning of:

  • alt

Match the pairs

<img src="dog.jpg" alt="A dog">Match it to what it does
<figure>
  <img src="x.jpg" alt="X">
</figure>
Match it to what it does
alt provides a text description for screen readers and when the image cannot loadMatch it to what it does
src specifies the path or URL of the image file to be displayedMatch it to what it does
<img src="cat.jpg">Match it to what it does
<img src="dog.jpg" alt="Dog"></img>Match it to what it does

Fill in the blanks

  1. <___ src="photo.jpg" alt="A cat">

    Hint: Type the self-closing element name used to embed an image

  2. <img ___="logo.png" alt="Logo">

    Hint: Type the attribute name that provides the image file path

  3. <img src="banner.jpg" ___="Banner">

    Hint: Type the attribute name that provides accessible alternative text for the image

  4. <figure>
      <img ___="cat.jpg" alt="Cat">
    </figure>

    Hint: Type the attribute that specifies which image file to display

  5. <p><img src="icon.png" ___="Icon"></p>

    Hint: Type the attribute that describes the image for screen readers and fallback display

Spot the error

Question 1

A<img src="cat.jpg">B<p>Caption here.</p>C<p>More text.</p>

Question 2

A<p>Hero image:</p>B<img src="hero.jpg" alt=Hero banner>C<p>Welcome text.</p>

Question 3

A<figure>B  <img src="sunset.jpg">C    alt="Sunset view">D  <figcaption>Sunset.</figcaption>E</figure>

Question 4

A<div>B  <img src="dog.jpg" alt="Dog">C  <img src="cat.jpg" alt="Cat">D  <image src="bird.jpg" alt="Bird">E</div>

Question 5

A<p>Profile photo:</p>B<img src="avatar.jpg" alt="Profile photo">C<img src="logo.png" alt="Logo">D<img src="banner.jpg" alt="Banner">E<img src="icon.png">