GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

Test your skills: HTML images

Learnwebdevelopment/Core/Structuringcontent/HTMLvideoandaudio

Learn_web_development/Core/Structuring_content/HTML_video_and_audio

The aim of this skill test is to help you assess whether you understand [images and how to embed them in HTML](/docs/Learn_web_development/Core/Structuring_content/HTML_images).

> [!NOTE]
> To get help, read our [Test your skills](/docs/Learn_web_development#test_your_skills) usage guide. You can also reach out to us using one of our [communication channels](/docs/MDN/Community/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/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:

100%

Here's the underlying code for this starting point:

```html live-sample___images-1
<h1>Basic image embed</h1>

<img />

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

<!-- Shared/setup CSS code -->

```css hidden live-sample___images-1 live-sample___images-2 live-sample___images-3 live-sample___images-1-finished live-sample___images-2-finished live-sample___images-3-finished
body {
background-color: white;
color: #333333;
font:
1em / 1.4 "Helvetica Neue",
"Helvetica",
"Arial",
sans-serif;
padding: 1em;
margin: 0;
}

* {
box-sizing: border-box;
}

img {
border: 1px solid black;
}
```

The updated content should look like this:

100%

<details>
<summary>Click here to show the solution</summary>

Your finished HTML should look like this:

```html-nolint live-sample___images-1-finished
<h1>Basic image embed</h1>

<img src="https://github.com/mdn/learning-area/blob/main/html/multimedia-and-embedding/tasks/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.

</details>

## 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:

100%

Here's the underlying code for this starting point:

```html live-sample___images-2
<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.

<details>
<summary>Click here to show the solution</summary>

Your finished HTML should look like this:

```html-nolint live-sample___images-2-finished
<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" />
```

</details>

## 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:

100%

Here's the underlying code for this starting point:

```html live-sample___images-3
<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
```

```css hidden live-sample___images-3 live-sample___images-3-finished
figcaption {
font-style: italic;
}
```

The updated content should look like this:

100%

<details>
<summary>Click here to show the solution</summary>

Your finished HTML should look like this:

```html live-sample___images-3-finished
<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>
```

</details>

Learn_web_development/Core/Structuring_content/HTML_video_and_audio

source: MDN Web Docs mirror · page

Cite this

"Test your skills: HTML images". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Structuring_content/Test_your_skills/Images

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·