Menu
Coddy logo textTech

Links

Part of the Fundamentals section of Coddy's HTML journey — lesson 21 of 60.

In HTML, a link (or hyperlink) is an element that connects one web page to another. 

You can create links to other web pages, files, locations within the same page or any other URL. Links are created using the <a> tag, which stands for anchor.

Here's the basic syntax for creating a link in HTML:

<a href="url">Link text</a>
  • <a>: The opening anchor tag.
  • href: The destination URL of the link.
  • Link text: The visible text that users will see and click on.
  • </a>: The closing anchor tag.

Here's an example of how to create a link to Google's homepage:

<a href="https://www.google.com">Visit Google</a>

In this example, when a user clicks on the text "Visit Google", they will be taken to https://www.google.com.

challenge icon

Challenge

Easy

Create an HTML document that includes the following links:

  1. A link that points to "https://coddy.tech" and displays the text "Visit Coddy".
  2. A link that points to "https://www.google.com" and displays the text "Visit Google".

Bonus: try clicking the links!

Cheat sheet

Links in HTML are created using the <a> (anchor) tag with the href attribute:

<a href="url">Link text</a>
  • href: The destination URL
  • Link text: The visible clickable text

Example:

<a href="https://www.google.com">Visit Google</a>

Try it yourself

<!DOCTYPE html>
<html>
    <body>
        <!-- Write code here -->
    </body>
</html>
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals