Quizz
The full text of this chapter, to read or revisit. To practise, do the exercises.
▶ Do the exercisesExercise 1 — Identify the Correct Syntax
Which of the following code snippets correctly shows an image with a link around it?
<a href="https://example.com"><img src="image.jpg" alt="Example"></a><img href="https://example.com" src="image.jpg" alt="Example"><a src="https://example.com"><img href="image.jpg" alt="Example"></a><link href="https://example.com"><img src="image.jpg" alt="Example"></link>Hint : Think about which tag is used for links and which attributes belong to each tag (links vs images).
Exercise 2 — Complete the Email Link
Complete the HTML code to create a proper email link that opens the user's email client with a subject line about Codémon support.
Hint : Remember the correct attribute for links and the proper protocol for email links.
Exercise 3 — Match HTML Attributes with Their Purpose
Match each HTML attribute with its correct purpose:
hrefsrcalttargetExercise 4 — Best Practice for Link Text
Which of the following link texts provides the best accessibility and user experience?
<a href="guide.html">Codémon Training Guide</a><a href="guide.html">Click here</a><a href="guide.html">https://codemon.com/guides/training</a><a href="guide.html">Read more...</a>Hint : Consider which link text clearly describes where the link will take the user without requiring additional context.
Exercise 5 — Complete the Accessible Image
Complete the HTML code to create an accessible image of Aquachu with 300 width and 200 height.
Hint : Think about the essential attributes for an image tag that provide both the image source and information for accessibility.
Exercise 6 — Choosing the Correct Path
You're working on an HTML file located at /codemon/guides/beginners.html. Which path would correctly link to an image at /codemon/images/aquachu.jpg?
"../images/aquachu.jpg""images/aquachu.jpg""/images/aquachu.jpg""../../images/aquachu.jpg"Hint : Consider where the HTML file is located relative to the image. You need to navigate from the current directory to reach the images directory.
Exercise 7 — Match Link Types with Examples
Match each type of link with its correct example:
Exercise 8 — Complete the Anchor Link
Complete the HTML code to create a table of contents with an anchor link to a section further down the page.
Hint : Consider how anchor links work - one element needs an identifier, and the link needs to reference that identifier with a special symbol.
Exercise 9 — Best Alt Text
Which alt text best describes a chart showing the relative strengths of different Codémon types?
Hint : Consider which alt text provides the most useful information about the content of the image without being too lengthy or too vague.
Exercise 10 — Complete the Phone Link
Complete the HTML code to create a proper phone link that allows mobile users to call the Codémon support line directly.
Hint : Think about the proper protocol to use for phone numbers in links, similar to how email links work.
Exercise 11 — Image Dimensions Best Practice
What's the best practice when using width and height attributes on images?
Hint : Consider how specifying dimensions affects page loading behavior and user experience.
Exercise 12 — Match Link Attributes with Values
Match each link attribute with an appropriate value:
hreftargetreldownload"https://codemon.com/guide""_blank""noopener noreferrer""codemon-guide.pdf"Exercise 13 — Complete the External Link
Complete the HTML code to create an external link that opens in a new tab with recommended security attributes.
Hint : Think about which attribute controls where a link opens and what additional security measures are recommended for external links.
Exercise 14 — Troubleshooting Broken Links
Your image isn't displaying, and you see a broken image icon. The HTML code is: <img src="/images/codemon.jpg" alt="Codémon">. What's the most likely issue?
Hint : Consider what causes a broken image icon to appear, and which part of the code controls where the browser looks for the image file.
Exercise 15 — Decorative Images
What's the correct way to handle a purely decorative image that doesn't add any meaningful content to the page?
<img src="decoration.jpg" alt=""><img src="decoration.jpg"><img src="decoration.jpg" alt="decorative image"><img src="decoration.jpg" role="presentation">Hint : Think about what's the best practice for alt text on images that are purely decorative and don't add content to the page.
Exercise 16 — Create a Thumbnail Link
Complete the HTML code to create a thumbnail image that links to a larger version of the same image.
Hint : Consider the correct structure for creating an image that also functions as a link, and which attributes belong to which elements.
Exercise 17 — Match Path Types with Scenarios
Match each type of path with the scenario where it's most appropriate to use:
Exercise 18 — Link Accessibility
Which of the following is a best practice for making links more accessible?
Hint : Consider how different users navigate web content, especially those using screen readers or other assistive technologies.
Exercise 19 — Complete the Image with Dimensions
Complete the HTML code to create an image of Pyrochu with appropriate width and height attributes.
Hint : Think about which attributes are used to specify the size of an image in pixels.
Exercise 20 — Correct Anchor Link
Which is the correct way to create a link that jumps to an element with id="types" on the same page?
<a href="#types">Jump to Types</a><a href="types">Jump to Types</a><a name="types">Jump to Types</a><a href="@types">Jump to Types</a>Hint : Remember the correct syntax for creating an anchor link to another part of the same page.
Exercise 21 — Best Image Format
Which image format would be most appropriate for a logo with transparent background on a website?
Hint : Consider which image formats support transparency and are commonly used for web graphics with clean edges.
Exercise 22 — Match Link Types with Examples
Match each type of link with its correct example:
<a href="https://www.example.com">Visit Example</a><a href="mailto:contact@codemon.com">Email Us</a><a href="tel:+15551234567">Call Support</a><a href="#section1">Go to Section 1</a>Exercise 23 — Create a Download Link
Complete the HTML code to create a link that will prompt the user to download a PDF file named 'codemon-guide.pdf' when clicked.
Hint : Consider which attribute is needed to specify the resource location and which attribute tells the browser to download the file instead of navigating to it.
Exercise 24 — Missing Image Behavior
What happens when a browser tries to load an image but the file is missing or the path is incorrect?
Hint : Think about why the alt attribute is important and what role it plays when images cannot be displayed.
Exercise 25 — Anchor Link Components
Match each part of an anchor link system with its correct syntax:
<a href="#section-id">Go to section</a><h2 id="section-id">Section Title</h2><a href="page.html#section-id">Go to section on another page</a><a href="#">Back to top</a>