📖 Scenario: You are creating a simple webpage for a local library. You want to add links so visitors can easily find the library's homepage and the contact page.
🎯 Goal: Build a basic HTML page with two anchor tags. One link should go to the library's homepage, and the other should go to the contact page.
📋 What You'll Learn
Create an HTML skeleton with <!DOCTYPE html>, <html>, <head>, and <body> tags
Add two anchor tags (<a>) inside the body
The first anchor tag must link to https://www.locallibrary.com with the text 'Library Homepage'
The second anchor tag must link to https://www.locallibrary.com/contact with the text 'Contact Us'
Use the href attribute correctly in both anchor tags
💡 Why This Matters
🌍 Real World
Creating navigation links is a fundamental skill for building websites that help users find important pages easily.
💼 Career
Web developers frequently add and manage links to connect different parts of a website or to external resources.
Progress0 / 4 steps
1
Create the basic HTML structure
Write the basic HTML skeleton with <!DOCTYPE html>, <html lang="en">, <head> including <meta charset="UTF-8"> and <title>Library Links</title>, and an empty <body> tag.
HTML
Hint
Start with the basic HTML page structure. Remember to include the lang attribute in the <html> tag and the charset meta tag inside <head>.
2
Add the first anchor tag for the homepage
Inside the <body> tag, add an anchor tag <a> with the href attribute set to https://www.locallibrary.com. The link text should be exactly 'Library Homepage'.
HTML
Hint
Use the href attribute inside the <a> tag to set the link destination. The text between the tags is what users will see and click.
3
Add the second anchor tag for the contact page
Below the first anchor tag, add another anchor tag with the href attribute set to https://www.locallibrary.com/contact. The link text should be exactly 'Contact Us'.
HTML
Hint
Remember to place the second anchor tag inside the <body> tag and below the first link. Use the correct URL and link text.
4
Add spacing between the links for readability
Add a line break tag <br> between the two anchor tags inside the <body> to separate the links visually.
HTML
Hint
Use the <br> tag to add a line break between the two links so they appear on separate lines.
Practice
(1/5)
1. What does the <a> tag do in HTML?
easy
A. Creates a clickable link to another page or resource
B. Defines a paragraph of text
C. Inserts an image into the page
D. Adds a heading to the page
Solution
Step 1: Understand the purpose of the <a> tag
The <a> tag is used to create links that users can click to go to other pages or resources.
Step 2: Compare with other tags
Other tags like <p>, <img>, and <h1> serve different purposes such as paragraphs, images, and headings.
Final Answer:
Creates a clickable link to another page or resource -> Option A
Quick Check:
Anchor tag = clickable link [OK]
Hint: Anchor tag always creates clickable links [OK]
Common Mistakes:
Confusing <a> with <p> or <img>
Thinking <a> adds images or text formatting
Ignoring the clickable nature of <a>
2. Which of the following is the correct syntax to create a link to "https://example.com" with the text "Visit Example"?
Step 1: Identify the correct protocol for email links
Email links use the mailto: protocol in the href attribute to open the email client.
Step 2: Check each option's syntax
<a href="mailto:contact@example.com">Send Email</a> uses mailto:contact@example.com correctly. <a href="email:contact@example.com">Send Email</a> uses wrong protocol 'email:', while others lack the protocol or use incorrect formats like 'mailto://'.
Final Answer:
<a href="mailto:contact@example.com">Send Email</a> -> Option B
Quick Check:
Email links use mailto: prefix [OK]
Hint: Use mailto: before email address in href [OK]
Common Mistakes:
Using email: instead of mailto:
Omitting mailto: prefix
Adding extra slashes after mailto:
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.