Skip to content
Kuza Ndoto Academy

Web Accessibility Basics

BeginnerChapter 5 · Page 23 of 255 min readUpdated 15 Nov 2026

Web accessibility (often shortened to a11y, because there are 11 letters between the a and the y) means building sites that everyone can use, including people who are blind, Deaf, have limited movement, have cognitive differences or are simply using an old phone in bright sunlight. Good HTML gets you most of the way there for free.

Who benefits?

The World Health Organization estimates that about 1.3 billion people, roughly one in six people worldwide, live with a significant disability. They use the web in different ways:

  • Screen readers read the page aloud or send it to a braille display. Common ones are NVDA (free, Windows), JAWS (Windows), VoiceOver (Apple) and TalkBack (Android).
  • Keyboard-only navigation: people who can't use a mouse move with Tab, Shift+Tab, Enter, Space and the arrow keys, or with switch devices that act like a keyboard.
  • Zoom and magnification for people with low vision.
  • Captions and transcripts for Deaf and hard-of-hearing people.

Accessibility also helps everyone else: captions on a noisy bus, high contrast in the sun, keyboard shortcuts for power users, simple language for second-language readers. And accessible sites tend to rank better in search engines, because search engines read pages much as a screen reader does.

WCAG and the four principles

The international standard is the Web Content Accessibility Guidelines (WCAG), published by the W3C's Web Accessibility Initiative. The current version is WCAG 2.2. Its guidelines are grouped under four principles, often remembered as POUR:

PrincipleMeaningHTML examples
PerceivableUsers can see or hear the content in some formAlt text, captions, enough colour contrast
OperableUsers can use every controlReal buttons and links, keyboard access, visible focus
UnderstandableContent and controls make senselang attribute, clear labels, helpful error messages
RobustWorks with many browsers and assistive technologiesValid, semantic HTML

Each guideline has success criteria at levels A, AA and AAA. Level AA is the usual target for websites and the one most laws and policies refer to.

The HTML checklist

Structure

  • Set the language: <html lang="en">.
  • Use landmarks: <header>, <nav>, <main>, <footer>.
  • Use one <h1> and headings in order without skipping levels.
  • Use lists for lists and tables (with <th> and <caption>) for data.

Content

  • Give every meaningful image useful alt text, and decorative images alt="".
  • Write link text that makes sense on its own, never "click here".
  • Add captions to video and transcripts to audio.
  • Don't use colour alone to convey meaning. "Fields in red are required" fails for colour-blind users; write "(required)" too.
  • Keep text contrast high. WCAG AA asks for a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text. Browser developer tools can check this for you.

Interaction

  • Use <button> for actions and <a href> for navigation.
  • Label every form control and group related ones with <fieldset>; see Accessible Forms.
  • Make sure everything works with the keyboard and that the focus outline is always visible.
  • Don't let media autoplay with sound.

Native HTML first, ARIA second

ARIA (Accessible Rich Internet Applications) is a set of attributes such as role, aria-label and aria-expanded that add accessibility information for custom widgets. It's powerful, but the first rule of ARIA is: if a native HTML element does the job, use it instead.

<!-- Avoid: needs role, tabindex and key handling to approach a real button -->
<div class="btn" role="button" tabindex="0">Save</div>

<!-- Better: focusable, keyboard-operable and announced correctly for free -->
<button type="button" class="btn">Save</button>

ARIA only changes what assistive technology announces; it doesn't add behaviour. The div above still won't respond to Enter or Space unless you write JavaScript for it. Badly used ARIA is worse than none, because it gives users wrong information. Two ARIA attributes you'll use often are aria-label, which names an element that has no visible text, such as an icon-only button, and aria-describedby, which links extra help text.

<button type="button" aria-label="Close menu">✕</button>

Keyboard users must Tab through every menu link on every page before reaching the content. A skip link at the very start of the body lets them jump straight to <main>. It's often hidden with CSS until it receives focus.

<body>
  <a href="#content" class="skip-link">Skip to main content</a>
  <header>…</header>
  <main id="content">…</main>
</body>

Try it: the keyboard test

Click inside the preview, then press Tab repeatedly. Watch where the focus goes, then press Enter on each "button".

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Keyboard test</title>
    <style>
      .fake { display: inline-block; padding: 6px 12px; background: #ddd; border-radius: 4px; cursor: pointer; }
    </style>
  </head>
  <body>
    <a href="#content">Skip to main content</a>
    <main id="content">
      <h1>Keyboard test</h1>
      <p><button type="button" id="real">Real button</button></p>
      <p><span class="fake" id="fake">Fake button (a span)</span></p>
      <p id="log">Nothing clicked yet.</p>
    </main>
    <script>
      const log = document.querySelector("#log");
      document.querySelector("#real").addEventListener("click", function () {
        log.textContent = "The real button worked.";
      });
      document.querySelector("#fake").addEventListener("click", function () {
        log.textContent = "The fake button worked.";
      });
    </script>
  </body>
</html>

Tab moves from the skip link to the real button, which shows a focus outline, and then leaves the page. It never stops on the fake button. Pressing Enter or Space on the real button shows "The real button worked." Clicking the fake button with a mouse works, but a keyboard user can't reach it at all. That's the whole case for native HTML in one example.

Testing your pages

  • Keyboard: unplug the mouse and try to use every feature with Tab, Enter, Space and arrow keys.
  • Automated checks: run Lighthouse (in Chrome's developer tools) or the WAVE tool. They catch missing alt text, low contrast and missing labels, but only part of the problems.
  • Screen reader: listen to your page with NVDA, VoiceOver or TalkBack.
  • Zoom: zoom to 200% and check that nothing overlaps or disappears.

Key points

  • Accessibility means everyone can perceive, operate and understand your site; WCAG 2.2 level AA is the usual target.
  • Semantic HTML (landmarks, headings, labels, alt text, real buttons) provides most accessibility for free.
  • Use native elements before ARIA; ARIA changes announcements, not behaviour.
  • Test with a keyboard, automated tools and a screen reader.
Up next · New chapter: PracticeProject: Personal Portfolio PageBuild a complete, semantic portfolio page.
→

Tip: use the ← and → keys to move between pages.