Test your skills: HTML images

The aim of this skill test is to help you assess whether you understand images and how to embed them in HTML.

Note: To get help, read our Test your skills usage guide. You can also reach out to us using one of our communication channels.

Images 1

In this task, we want you to embed an image of some Blueberries into the page.

To complete the task:

  1. Add the path to the image to an appropriate attribute to embed it on the page. The image is called blueberries.jpg, and it is available at a path of https://github.com/mdn/learning-area/blob/main/html/multimedia-and-embedding/tasks/images/images/blueberries.jpg?raw=true.
  2. Add some alternative text to an appropriate attribute to describe the image, for people that cannot see it.
  3. Give the <img> element a width attribute of 400 and an appropriate height attribute so that it displays at the correct aspect ratio, and doesn't cause a re-render when it loads. The image's intrinsic size is 615 x 419 pixels.

The starting point of the task looks like this:

Here's the underlying code for this starting point:

html
<h1>Basic image embed</h1>

<img />

<p>You should see a picture of some blueberries above.</p>

The updated content should look like this:

Click here to show the solution

Your finished HTML should look like this:

html
<h1>Basic image embed</h1>

<img src="https://github.com/mdn/learning-area/blob/main/html/multimedia-and-embedding/tasks/images/images/blueberries.jpg?raw=true"
     alt="blueberries" width="400" height="273" />

<p>You should see a picture of some blueberries above.</p>

We calculated the correct height value to set using the calculation 400 x 419/615.

Images 2

In this task, you already have a full-featured image, but we'd like you to add a tooltip that appears when the image is moused over. You should put some appropriate information into the tooltip.

The starting point of the task looks like this:

Here's the underlying code for this starting point:

html
<h1>Basic image title</h1>

<img
  src="https://github.com/mdn/learning-area/blob/main/html/multimedia-and-embedding/tasks/images/larch.jpg?raw=true"
  alt="Several tall evergreen trees called larches" />

We've not provided finished content for this task, as it looks the same as the starting point.

Click here to show the solution

Your finished HTML should look like this:

html
<h1>Basic image title</h1>

<img
  src="https://github.com/mdn/learning-area/blob/main/html/multimedia-and-embedding/tasks/images/larch.jpg?raw=true"
  alt="Several tall evergreen trees called larches"
  title="And now, Number 1, The Larch" />

Images 3

In this task, you are provided with both a full-featured image and some caption text. What you need to do here is add elements that will associate the image with the caption.

The starting point of the task looks like this:

Here's the underlying code for this starting point:

html
<h1>Image and caption</h1>

<img
  src="https://github.com/mdn/learning-area/blob/main/html/multimedia-and-embedding/tasks/images/firefox.png?raw=true"
  alt="An abstract flaming fox wrapping around a blue sphere"
  width="446"
  height="460" />
The 2019 Firefox logo

The updated content should look like this:

Click here to show the solution

Your finished HTML should look like this:

html
<h1>Image and caption</h1>

<figure>
  <img
    src="https://github.com/mdn/learning-area/blob/main/html/multimedia-and-embedding/tasks/images/firefox.png?raw=true"
    alt="An abstract flaming fox wrapping around a blue sphere"
    width="446"
    height="460" />
  <figcaption>The 2019 Firefox logo</figcaption>
</figure>