Links in HTML

Learn how to connect your pages and navigate your website.

Basic Link

The <a> tag creates a link. Use the href attribute to set the destination:

<a href="https://example.com">Visit Example</a>
      

This creates a clickable link that takes the user to another page.

Linking to Your Own Pages

You can link to other pages in your project like this:

<a href="index.html">Go to Home</a>
<a href="text.html">First HTML File</a>
      

This is how websites connect their sections together.

Opening Links in a New Tab

Use target="_blank" to open a link in a new tab:

<a href="https://google.com" target="_blank">Open Google</a>
      

Email Links

You can create a link that opens the user's email app:

<a href="mailto:someone@example.com">Send Email</a>
      

Lesson Checkpoint

Before moving on, make sure you have:

  1. Added several links to your index.html file.
  2. Linked your pages together using <a> tags.
  3. Committed your changes to GitHub.
  4. Viewed your updated site on GitHub Pages.

Use the navigation bar to continue to the next lesson.