Lesson: HTML Links

Absolute, Relative, Internal, External, Same-Page, Email, and Phone Links

1. Absolute Links (External)

Absolute links contain the full address, including http:// or https://.

<a href="https://developer.mozilla.org/">Visit MDN</a>
Visit MDN

2. Absolute Links (Internal from Root)

Use a leading slash / to start from your site's root.

<a href="/mgu/technology/html_css_js_part_1-3.html">HTML/CSS/JS Lesson</a>
HTML/CSS/JS Lesson

3. Relative Links

Relative links are based on the location of the current page.

Same folder

<a href="lesson2.html">Lesson 2</a>
Lesson 2

Subfolder

<a href="technology/lesson3.html">Lesson 3</a>
Lesson 3

Parent folder

<a href="../index.html">Back to Homepage</a>
Back to Homepage

4. Same-Page (Anchor) Links

Link to an element on the same page using an id attribute.

<h3 id="chapter3">Chapter 3</h3>
<a href="#chapter3">Go to Chapter 3</a>
Go to Chapter 3

Chapter 3: CSS Basics

This is the target section for the same-page link above.

5. Email Links

Use the mailto: protocol to open the user’s email client.

<a href="mailto:teacher@example.com">Email the Teacher</a>
Email the Teacher

6. Phone Links

Use the tel: protocol for click-to-call on mobile.

<a href="tel:+15555550123">Call Us</a>
Call Us