Lesson 1: the rule

Use a link when the user goes somewhere

<a href="…" >

Use links for navigation to pages, sections, files, email addresses, phone numbers or other resources.

Use a button when the user does something

<button type="button">

Use buttons for actions that change, submit, open, close, reveal, save, delete or otherwise affect the current interface.

Pop quiz: what should it be?

Answer the question based on what the control actually does, not how it looks in the design.

Worked examples

Blackboard code

Navigation: use a link

<a href="/pricing">Pricing</a>

Action: use a button

<button type="button">Open menu</button>

Avoid: link that behaves like a button

<a href="#" onclick="saveSettings()">Save settings</a>

Avoid: button that behaves like a link

<button type="button" onclick="location.href='/pricing'">Pricing</button>

Teacher’s notes

A button and a link are not just visual styles. They expose different roles to assistive technologies and have different expected keyboard behaviour.

Important: This page is designed to support WCAG 2.2 AAA and EN 301 549-aligned implementation, but compliance still requires testing in the final production context, including content, design, browser behaviour and assistive technology support.

Homework before release

These checks are included as reminders because they are easy to break when the visual design changes.

Further reading

Five solid references for the next lesson.