Lesson 2 of 8

Links and images

Goal

Tags with attributes

01

Explanation

Some tags need extra information that you write inside the tag itself. These pieces of information are called attributes. A link needs the address of the page it takes you to, and an image needs a source to load from.

A link is written like this: <a href="...">link text</a>, and an image like this: <img src="..." alt="...">.

The alt attribute isn't optional. It's the text a screen reader reads out to people who can't see the image, and it's what shows up in place of the image if it fails to load.

02

Your task

Add a link to a site you love, and add an image with alt text that describes it.

Checks

4 checks
  1. There is an a element whose href starts with http
  2. The link text isn't empty
  3. There is an img element with a src
  4. The image has alt text that describes it in more than one word
03

Hints

0/3
index.html
Preview
index.html100%
–/4

Press “Run and check” to grade your code.

4 checks listed under “Your task”.