Skip to the workspace
Pebellslearn by building
Text Content  ›  Lesson

Links: The a Element

Links 12 minThe a element with an href makes a link to another page, a place on the same page, an email address or a phone number, and its text should say where it leads.

html / Links: The a Element

Explore each scene at your own pace.

01 · The rule

The rule

Links: The a Element

The a element with an href makes a link to another page, a place on the same page, an email address or a phone number, and its text should say where it leads.

Create descriptive links and inspect their destinations and in-page targets.

Links are what make the web a web. The "HT" in HTML, HyperText, means exactly this: text that leads somewhere else. One element does all of it, and one attribute decides where it goes.

The rule

a plus href goes somewhere; the link text says where.

A link is an a (anchor) element with an href (hypertext reference):

<a href="https://www.example.org/timetable">Train timetable</a>

The value of href decides the destination:

href value Goes to
https://site.example/page an absolute URL: a full address, often another site
about.html or /team/ a relative URL: a page on your own site
#faq a place on the same page with id="faq"
mailto:hello@site.example a new email to that address
tel:+911234567890 a phone call, on devices that can make one

Jumping within a page works by pairing a fragment with an id:

<a href="#faq">Jump to questions</a>
...
<h2 id="faq">Frequently asked questions</h2>

target="_blank" opens the link in a new tab. Use it sparingly and say so in the link text, because unexpected tabs disorient people, especially screen reader users. Modern browsers already protect the original page from the new tab, so you no longer need extra attributes for that in most cases.

The link text matters. Screen readers can list every link on a page, stripped of the sentence around it. "Click here", "read more" and "link" become meaningless in that list. Write text that makes sense on its own: "Download the 2026 fee schedule (PDF)".

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.