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:
- Added several links to your
index.htmlfile. - Linked your pages together using
<a>tags. - Committed your changes to GitHub.
- Viewed your updated site on GitHub Pages.
Use the navigation bar to continue to the next lesson.