HTML / LESSON 03

Links & navigation

Connect pages, sections and useful destinations.

Beginner6 min read · estimateUpdated Nov 1, 2026
Download HTML
In this lessonA link needs a destinationJump to a sectionLinks versus buttonsTry it yourselfFurther reading

01A link needs a destination

The href attribute sets the destination. Use meaningful link text: “Read our services” tells people more than “Click here”.

<a href="services.html">Read our services</a>
<a href="https://dect.dev">Visit DECT</a>

02Jump to a section

Give a section a unique id, then link to it with # followed by that id. A link to another page can include a fragment too.

<a href="#contact">Contact details</a>
<section id="contact">
  <h2>Contact details</h2>
</section>

03Links versus buttons

Use a link to go somewhere. Use a button to perform an action, such as opening a menu. Do not use an anchor without href as a replacement for a button.

<nav aria-label="Main">
  <a href="index.html">Home</a>
  <a href="services.html">Services</a>
</nav>
<button type="button">Open menu</button>

04Try it yourself

Add a “Back to about” link under Contact.

EDITABLE EXAMPLE

HTML & CSS only. Scripts and form submissions are disabled.

Further reading

Use the MDN learning guides and HTML Living Standard for deeper explanations and current browser guidance.

ONE STEP FURTHER

Small steps. Real understanding.

Try the example in your own project before moving on.

Progress is saved only in this browser.