Why HTML accessibility matters

Over 1.3 billion people globally live with some form of disability. Web accessibility ensures your site is usable by people with visual, motor, auditory, and cognitive disabilities. Beyond ethics, it's increasingly a legal requirement โ€” the ADA in the US and EN 301 549 in the EU both mandate accessible web content.

Google has also confirmed that accessible sites tend to rank better, since accessibility improvements overlap heavily with good SEO practices โ€” both rely on meaningful structure, descriptive text, and clear navigation.

ARIA labels and roles

ARIA (Accessible Rich Internet Applications) attributes add semantic context to HTML elements. Use them when native HTML semantics aren't enough:

<!-- Button without visible text -->
<button aria-label="Close dialog">โœ•</button>

<!-- Navigation landmark -->
<nav aria-label="Main navigation">...</nav>

<!-- Live region for dynamic content -->
<div aria-live="polite" id="status"></div>

<!-- Expandable section -->
<button aria-expanded="false" aria-controls="panel">Toggle</button>
<div id="panel" hidden>...</div>
โš ๏ธ Rule: Never use ARIA to override native semantics. Fix the HTML first. ARIA is a last resort, not a replacement for semantic markup.

Keyboard navigation

Every interactive element on your page must be reachable and operable with a keyboard alone. Test by pressing Tab to move through the page:

<!-- Skip link -->
<a href="#main-content" class="skip-link">Skip to main content</a>
<main id="main-content">...</main>

Images and alt text

Every <img> element needs an alt attribute. What goes in it depends on the image's role:

Accessible forms

Forms are among the most common accessibility failures on the web. The rules are simple:

<!-- Always associate labels with inputs -->
<label for="email">Email address</label>
<input type="email" id="email" name="email" required
       aria-describedby="email-hint">
<p id="email-hint">We'll send a confirmation link.</p>

<!-- Error messages -->
<input type="email" aria-invalid="true" aria-describedby="email-error">
<p id="email-error" role="alert">Enter a valid email address.</p>

Color and contrast

WCAG 2.1 requires a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text (18px+). This affects many common design choices โ€” light grey text on white fails, for example.

Use the Color Picker tool to check contrast and pick accessible color pairs.

Testing your page