▶ TrainingGet Pro
All tools & lessonsAll toolsAllGet the appApp
Learning departments Music, Math, Cookery, Programming and Art are open – explore →

HTML and CSS lesson 6: Images and alt text

US version. US grades and US spelling. · UK version of this lesson

Pictures use the single tag <img src="…" alt="…">. Alt text describes the picture for anyone who can't see it. A complete 40-minute HTML and CSS lesson for beginners (Grades 6–7), from Unit 2: Links, images and tables. You build real web pages right here in your browser – nothing to install.

Time
40 minutes + 20 min homework
Grade
Grades 6–7 (ages 11–12)
You need
A computer or tablet, paper and a pencil
Graded
Instantly, with explanations

For parents: how to use this lesson

You don't need to know HTML yourself. The lesson explains each step on screen, the way Mr Babbage, our Head of Computing, likes it: a worked example first, then a go for your child. When your child builds a page, the browser draws it straight away and Classfern grades it with a checklist.

  1. Read what your child will learn together.
  2. Press Start the lesson below. Sit with your child for the teaching and the worked example (about 15 minutes): ask them to point at each tag and say what it does.
  3. Let them do the practice on their own. If a page doesn't look right, the checklist says what is missing – let them find the mistake before you help.
  4. Finish with the exit questions and the talk question: “Close your eyes while a partner reads only your alt text. Could you picture the image?”
  5. Later that day or the next day: the homework (20 minutes), then a practice test.

Watch out for

  • Alt text is a caption everyone sees. Alt text is read by screen readers; a caption (<figcaption>) is for everyone.
  • <img> needs </img>. It is one tag on its own.

Miss Lovelace's tip for home: ask your child to change one thing on their page – a word, a color, a size – and predict what will happen before they look. Predicting first is how programmers learn fastest.

What your child will learn

Learning goal: show a picture with <img>.

Success looks like

  • I can show a picture with <img>.
  • I can write useful alt text.
  • I can credit the person who made a picture.

Key words

image · src · alt text · screen reader · decorative image · figure · caption · credit

What to have ready

  • A device with a web browser (pages are built and checked right in the browser – nothing to install)
  • Paper for planning and sketching
  • A keyboard helps for typing code (a tablet works too)

The big ideas (for the adult)

<img> is a single tag – it has no closing tag, because there is nothing to wrap. src (source) says which picture file to show; width can set its size in pixels.

Alt text (alt="…") is read aloud by screen readers and shown if the picture can't load. Describe what matters: "a ginger cat asleep on a blue cushion" is better than "cat" or "image". A picture that is only decoration gets an empty alt="", so screen readers skip it.

Pictures belong to the people who made them, even on the internet. Use your own pictures or ones you are allowed to use, and give credit. A <figure> with a <figcaption> puts a caption under a picture.

Worked example: a picture with alt text and a caption

<figure>
<img src="/assets/coding/html/img/owl.svg" alt="a brown owl sitting on a branch" width="200">
<figcaption>An owl at night</figcaption>
</figure>

The lesson, step by step

40 minutes in 5 parts
PartTimeHow it is checked
Starter5 minGraded by Classfern
Learn8 minRead, watch and talk
See it7 minGraded by Classfern
Practice15 minGraded by Classfern
Check and reflect5 minGraded by Classfern + self-check

The lesson

It runs here on the page. No sign-up and no names – nothing you type is sent anywhere. Each visit picks a new mix of questions.

Homework

20 minutes: predict what the browser will do, build or fix a short page, and check the key ideas – then a short reflection. New questions every time, all graded instantly.

Practice tests

All computer science practice tests · All 20 HTML and CSS lessons

Curriculum

CSTA K–12 Computer Science Standards (2017), grades 6–8: 2-AP-16 – Use existing code, media and libraries in original programs, with attribution; 2-IC-21 – Discuss bias and accessibility in the design of existing technologies.

The standard codes are CSTA's; the descriptions are our own words.

Our lessons and questions are our own. They are not written or endorsed by any government department, testing agency or exam board. HTML and CSS are open web standards; Classfern is not affiliated with the organisations that publish them.