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.
The basic link
<a href="https://www.deped.gov.ph">Visit the DepEd website</a>
<a>creates the link.hrefholds the destination address.- The text between the tags is what people see and click — the link text.
<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>
Absolute and relative links
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.
Opening a link in a new tab
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.
<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.
Jump links: going to a section of the same page
Give an element an id, then link to it with # plus the id. This is how "Table of Contents" links work on long pages.
<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>.
Email and phone links
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.
Writing good link text
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>.
Making an image a link
Put an <img> inside <a>, and the picture becomes clickable. Websites often do this with the logo, linking it back to the homepage.
<a href="https://www.example.com">
<img src="/img/school-logo.svg" alt="Sample National High School – Home" width="120" height="120">
</a>
Link colors
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. 🙂
By Sir Reyel · Last updated 2026-12-04