Skip to content

Hyperlinks

A hyperlink allows you to navigate from one page to another by clicking on it.
It is one of the foundations of the web, making it possible to connect pages together.

The term “hypertext” was introduced by Ted Nelson in 1965.

HTML (HyperText Markup Language) is one of the first large-scale practical applications.


To create a link, we use the <a> tag (short for “anchor”).

<a href="page.html">Go to the page</a>
  • href: defines the link address (the “path”)
  • The text between <a> and </a> is what’s clickable

<a href="about.html">About</a>
<a href="https://wildcodeschool.com">Wild Code School</a>
<a href="../home.html">Back to home</a>
<a href="/pages/contact.html">Contact</a>

<h2 id="quote">Cat quote</h2>
<a href="#quote">See the quote</a>

<a href="mailto:bob@example.com">Send an email</a>
<a href="tel:+3361020304">Call now</a>

Very useful on mobile: one click = a call or an email.


<a href="..." title="Visit our Facebook page">Facebook Page</a>

Screen readers can read this title to provide more context.


<a href="https://example.com" target="_blank">Visit the site</a>

<a href="cv.pdf" download="cv-bob-smith.pdf">Download my CV</a>

The file will be downloaded with the specified name.


Bad:

<a href="...">Click here</a>

Better:

<a href="...">Visit our Facebook page</a>
  • . → current folder
  • .. → go up one folder
  • / → site root

Link typeSyntax
Internal page<a href="page.html">Link</a>
External page<a href="https://...">Link</a>
To a section<a href="#id">Link</a> + <h2 id="id">Heading</h2>
Mail<a href="mailto:mail@example.com">Send an email</a>
Telephone<a href="tel:+33...">Call</a>
New tabtarget="_blank"
Downloaddownload="filename"
Hover infotitle="Text"