Aral Code

Links & Media Lesson 16 of 42

HTML Links — Connecting Pages Together

Create links with the a element and href. Learn absolute vs relative links, opening in a new tab, jump links, email and phone links, and good link text.

Links are what make the web a "web." Without them, every page would be an island. With a single element — <a>, short for anchor — you can send readers to another website, another page of your site, a section of the same page, or even open their email app or phone dialer.

<a href="https://www.deped.gov.ph">Visit the DepEd website</a>
  • <a> creates the link.
  • href holds the destination address.
  • The text between the tags is what people see and click — the link text.
Example Links to other websites
<p>Check typhoon updates at <a href="https://www.pagasa.dost.gov.ph">PAGASA</a>.</p>
<p>Read about our heroes on <a href="https://en.wikipedia.org/wiki/Jos%C3%A9_Rizal">Wikipedia</a>.</p>

There are two kinds of addresses:

  • Absolute URL — the full address, including https://. Use it for other websites. Example: https://www.philhealth.gov.ph
  • Relative URL — a short address that's relative to the current page. Use it for pages on your own site. Example: about.html
<!-- Links between your own pages (same folder) -->
<a href="index.html">Home</a>
<a href="about.html">About Us</a>
<a href="contact.html">Contact</a>

Relative links keep working even if you move your whole site to a new domain. You'll learn more about paths like images/photo.jpg and ../index.html in the File Paths lesson.

Add target="_blank" to open the link in a new tab. It's common for links to other websites, so readers don't leave your page.

Example target=_blank
<p><a href="https://www.google.com" target="_blank" rel="noopener">Search on Google (opens in a new tab)</a></p>

The rel="noopener" part is a small security habit: it stops the new page from controlling your page. Modern browsers do this automatically now, but adding it doesn't hurt.

Give an element an id, then link to it with # plus the id. This is how "Table of Contents" links work on long pages.

Example Jump to a section
<p><a href="#luzon">Luzon</a> | <a href="#visayas">Visayas</a> | <a href="#mindanao">Mindanao</a></p>
<h2 id="luzon">Luzon</h2>
<p>The largest island group, home to Metro Manila and the Banaue Rice Terraces.</p>
<p>...</p><p>...</p><p>...</p>
<h2 id="visayas">Visayas</h2>
<p>The central islands, including Cebu, Bohol, Iloilo and Leyte.</p>
<p>...</p><p>...</p><p>...</p>
<h2 id="mindanao">Mindanao</h2>
<p>The southern island group, with Davao, Cagayan de Oro and Zamboanga.</p>
<p>...</p><p>...</p><p>...</p>

You can also link to a section on another page: <a href="about.html#teachers">Our Teachers</a>.

mailto: opens the visitor's email app with your address filled in. tel: lets phone users tap to call. These are very handy for small businesses and school offices.

<a href="mailto:registrar@example.com">Email the Registrar</a>
<a href="tel:+639171234567">Call us: 0917 123 4567</a>

For tel:, write the number with no spaces, using the country code +63 and dropping the first 0 of a mobile number.

Link text should tell people where the link goes, even if they read it alone. Screen reader users often pull up a list of all the links on a page, and "click here, click here, click here" means nothing to them.

<!-- Bad -->
For the enrollment form, <a href="form.html">click here</a>.

<!-- Good -->
Download the <a href="form.html">enrollment form</a>.

Put an <img> inside <a>, and the picture becomes clickable. Websites often do this with the logo, linking it back to the homepage.

Example A clickable logo
<a href="https://www.example.com">
  <img src="/img/school-logo.svg" alt="Sample National High School – Home" width="120" height="120">
</a>

By default, unvisited links are blue and underlined, and visited links are purple. You can change this with CSS later. Whatever colors you choose, make sure links still look clickable.

Quick Quiz

Check what you learned. Walang grade ito, practice lang. 🙂

1. Which attribute holds the destination of a link?
2. Which link correctly goes to another website?
3. How do you link to an element with id="contact" on the same page?
4. Which link text is best?
5. What does target="_blank" do?

By Sir Reyel · Last updated 2026-12-04