HTML Links
Connect pages and resources with accessible links.
Links turn separate resources into the web. The a element needs a useful destination and link text that explains where it goes. Links navigate; buttons perform actions. Keeping that distinction makes keyboard behavior, context menus, history, and assistive technology predictable.
Choose the right kind of URL
Absolute URLs include a scheme and domain. Root-relative paths start at the site root. Document-relative paths resolve from the current file. Fragment links target a unique id on the same page, while mailto and tel links request an external application.
<nav aria-label="Course links">
<a href="/courses/html">HTML course</a>
<a href="./forms.html">Forms lesson</a>
<a href="#practice">Jump to practice</a>
<a href="https://developer.mozilla.org/en-US/docs/Web/HTML">HTML reference on MDN</a>
</nav>- Write link text that makes sense by itself.
- Use a stable path type intentionally.
- Target fragments with unique IDs.
- Keep navigation in links and actions in buttons.
- Tell people when a link downloads a file or opens another application.
Handle new tabs and downloads responsibly
Most links should open in the current tab so users keep control. When a new tab is genuinely useful, use target=_blank and include rel=noopener. The download attribute suggests a download for same-origin resources, but servers and browsers still control delivery.