How to create links

Use an anchor

The href attribute gives the destination; the content gives the link its accessible name.

<a href="/about.html">About this site</a>
<a href="https://example.com/">Visit Example</a>
<a href="#requirements">Jump to requirements</a>

Choose the right path

  • An absolute URL includes the scheme and host
  • A root-relative path such as /help/ starts at your site root
  • A relative path such as next.html starts from the current document
  • An ID destination needs a matching element such as id="requirements"

Make links accessible

Use destination-focused text: “Download the course outline (PDF)” is more useful than “click here.” Avoid placing multiple adjacent links with identical vague names.

Open new tabs carefully

Normal links should usually remain in the same tab. If a new tab is essential, tell users and prevent opener access.

<a href="https://example.com/report"
   target="_blank" rel="noopener noreferrer">
  Annual report (opens in a new tab)
</a>