Hyperlinks & Navigation
Hyperlinks connect pages. In this lesson, we will look at anchor tags (<a>), absolute/relative routes, and target parameters.
1 Anchor Tags, absolute/relative href, and target blank parameters
Navigation parameters are defined inside anchor tags:
- href Attribute: Specifies the target URL path.
- Absolute Links: Reference full domain targets: `href="https://google.com"`.
- Relative Links: Reference files relative to the current workspace root: `href="/contact.html"`.
- target="_blank": Forces the browser to open the link target in a new window or tab.
2 Anchor Elements Code
Let's look at anchor links:
HTML — Hyperlinks
<!-- Absolute target opening in new tab -->
<a href="https://github.com" target="_blank">Visit GitHub</a>
<!-- Relative link target -->
<a href="/about.html">Learn About Us</a>
3 Code Challenge
Challenge: Create an anchor tag linking to an email address (hint: use `mailto:email@example.com` inside the `href` attribute) and test it.