Web Accessibility

HTML Accessibility

Create inclusive web experiences that work for everyone. Learn WCAG guidelines, semantic HTML, ARIA attributes, and accessibility testing techniques.

How do you make HTML accessible?

Start with semantic HTML: real headings in order, landmarks, <button> for actions and <a> for links, a <label> for every form field, and alt text on meaningful images. Make sure everything works with the keyboard alone and focus is always visible, set lang on <html>, and add ARIA only when no native element does the job.

<html lang="en">
<a class="skip" href="#main">Skip to content</a>
<label for="email">Email</label>
<input id="email" type="email" autocomplete="email" required>
<button type="submit">Subscribe</button>
<img src="chart.png" alt="Sales doubled from 2023 to 2024">

Web Accessibility Fundamentals

Web accessibility ensures that websites and applications are usable by people with disabilities. It's not just a legal requirement—it's about creating inclusive digital experiences for everyone.

Visual Impairments

Screen readers, high contrast, magnification

Hearing Impairments

Captions, transcripts, visual indicators

Motor Impairments

Keyboard navigation, voice control

WCAG 2.1 Principles

1. Perceivable

Information must be presentable in ways users can perceive

2. Operable

Interface components must be operable by all users

3. Understandable

Information and UI operation must be understandable

4. Robust

Content must be robust enough for various assistive technologies

Complete Accessibility Implementation

Comprehensive example demonstrating semantic HTML, ARIA attributes, keyboard navigation, screen reader support, and inclusive design patterns.

Code Editor

<form>
  <!-- Every input needs a label -->
  <label for="email">Email</label>
  <input id="email" type="email" autocomplete="email" aria-describedby="email-hint" required>
  <small id="email-hint">We'll never share it.</small>

  <!-- Group related controls -->
  <fieldset>
    <legend>Plan</legend>
    <label><input type="radio" name="plan" checked> Free</label>
    <label><input type="radio" name="plan"> Pro</label>
  </fieldset>

  <button type="submit">Subscribe</button>
</form>
<img src="https://picsum.photos/id/30/120/80" alt="A coffee mug on a desk">

Preview

Testing & Tools

Automated Testing

  • • axe DevTools browser extension
  • • Lighthouse accessibility audit
  • • WAVE Web Accessibility Evaluator
  • • Pa11y command line tool

Manual Testing

  • • Keyboard-only navigation
  • • Screen reader testing (NVDA, JAWS)
  • • High contrast mode
  • • Color blindness simulation

Accessibility Testing Checklist

  • All images have descriptive alt text
  • Forms have proper labels and error handling
  • All interactive elements are keyboard accessible
  • Color contrast meets WCAG AA standards
  • Content is organized with proper headings
  • No content relies solely on color or sound

HTML Accessibility — step by step

1 / 4
1

Write semantic HTML first

Semantic HTML is the foundation of accessibility. Native elements like button, a, and input have built-in keyboard support, focus management, and ARIA roles — free of charge.

1 of 4
🔍The Accessibility Tree
Browsers build an accessibility tree alongside the DOM. Assistive technologies like screen readers read the accessibility tree, not the DOM directly. Semantic HTML populates this tree correctly; ARIA attributes can supplement or override it when needed.

🎯 Quick Check

Which standard ensures digital content is accessible to people with disabilities?

HTML Accessibility: summary

Key points

  • The first rule of ARIA: don't use ARIA if a native HTML element already provides the behaviour.
  • Test by using only the Tab, Enter, Space and arrow keys, and with a screen reader (VoiceOver or NVDA).
  • Lighthouse and axe DevTools find many problems automatically, but not all of them.
  • Error messages should be linked to their field with aria-describedby and not rely on colour alone.

Frequently asked questions

›What is WCAG?

The Web Content Accessibility Guidelines are the international standard for web accessibility. Most laws and policies require level AA conformance.

›Does accessibility help SEO?

Yes, much of it overlaps: descriptive headings, alt text, meaningful link text and fast, well-structured pages help both users and search engines.