Links (a and href)

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Links (a and href)

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which element is used to create a hyperlink in HTML?
A <a>
B <link>
2. Which attribute on <a> sets the link destination?
A src
B href
3. True or false: href="about.html" is a relative URL.
A True
B False
4. What goes between the opening and closing <a> tags?
A The visible link text the user clicks
B The href URL value
5. True or false: <a> without an href attribute is invalid HTML.
A True
B False

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1<a href="about.html">About us</a> A<p>Read the <a href="guide.html">guide</a>.</p>
2<a href="https://bbc.com">BBC</a> Bhref must have a value - href="url" with a destination URL in double quotes
3href specifies the URL destination - without it the anchor has no link to follow CAn absolute URL link - includes the full protocol https:// to navigate to an external site
4<a> is an inline element - it wraps text inside block elements like <p> or <li> D<href> is not an HTML element - use <a href="page.html">Go</a> instead
5<a href>Click here</a> EA link that navigates to about.html when clicked - 'About us' is the visible clickable text
6<href="page.html">Go</href> F<li><a href="shop.html">Shop</a></li>

Definitions

href

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
<a ___="about.html">About</a>
2.
<___ href="contact.html">Contact</a>
3.
<p>See the <a ___="faq.html">FAQ</a> page.</p>
4.
<a ___="https://example.com">Visit</a>
5.
<a href="home.html">Home</___>

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A <a href>Click here</a>
B <p>Some text.</p>
C <p>More text.</p>
Question 2
A <p>Visit our site:</p>
B <a href="index.html>Home</a>
C <p>Thanks for visiting.</p>
Question 3
A <nav>
B <a href="home.html">Home</a>
C <href="about.html">About</href>
D <a href="contact.html">Contact</a>
E </nav>
Question 4
A <ul>
B <li><a href="one.html">One</a></li>
C <li><a href="two.html">Two</a></li>
D <li><A href="three.html">Three</A></li>
E </ul>
Question 5
A <p>Links below:</p>
B <a href="news.html">News</a>
C <a href="sport.html">Sport</a>
D <a href="weather.html">Weather</a>
E <a>Travel</a>

Answer Key

Links (a and href)
Section A: Quick Questions
Q1
A — <a>
Q2
B — href
Q3
A — True
Q4
A — The visible link text the user clicks
Q5
B — False
Section B: Match the Pairs
Q1
<a href="about.html">About us</a> → A link that navigates to about.html when clicked - 'About us' is the visible clickable text
Q2
<a href="https://bbc.com">BBC</a> → An absolute URL link - includes the full protocol https:// to navigate to an external site
Q3
href specifies the URL destination - without it the anchor has no link to follow → <p>Read the <a href="guide.html">guide</a>.</p>
Q4
<a> is an inline element - it wraps text inside block elements like <p> or <li> → <li><a href="shop.html">Shop</a></li>
Q5
<a href>Click here</a> → href must have a value - href="url" with a destination URL in double quotes
Q6
<href="page.html">Go</href> → <href> is not an HTML element - use <a href="page.html">Go</a> instead
Section C: Definitions
Q1
href — An attribute on the <a> element that specifies the URL destination of the hyperlink. Without href, the link has no destination to navigate to.
Section D: Fill in the Blanks
Q1
<a href="about.html">About</a>
Q2
<a href="contact.html">Contact</a>
Q3
<p>See the <a href="faq.html">FAQ</a> page.</p>
Q4
<a href="https://example.com">Visit</a>
Q5
<a href="home.html">Home</a>
Section E: Spot the Error
Q1
A — The href attribute is missing its value. It must be href="url" with a destination URL in double quotes.
Q2
B — The href value is missing its closing double quote. It should be href="index.html".
Q3
C — <href> is not an HTML element. Links use the <a> element: <a href="about.html">About</a>.
Q4
D — HTML tag names must be lowercase. <A> and </A> are non-standard - use <a> and </a>.
Q5
E — The anchor element is missing the href attribute. Without href, the link has no destination. Add href="url".