Accessibility
Accessibility (a11y) means everyone can use your page, including people who are blind, use only a keyboard, or have low vision. Good HTML does most of the work for free.
Millions of people use the web differently: blind users listen with screen readers, some people can't use a mouse, others zoom in a lot or use their phone with one hand. An accessible website works for all of them. It's also often required by law for government and large business sites, and it usually makes the site better for everyone - clear labels and big buttons help all users.
The good news: most accessibility comes from using HTML correctly - real buttons, proper headings, labels and alt text. You don't need special tools to start.
The most important habits
- Give every image an
alttext that says what it shows. A purely decorative image gets an emptyalt="". - Use real buttons (
<button>) for actions and links (<a>) for going to another page. A<div>with a click handler can't be reached with the keyboard. - Connect every form box to a
<label>. - Use headings in order (h1, h2, h3). Screen-reader users jump between headings to find things.
- Set the language:
<html lang="en">orlang="hi"for Hindi. - Don't use colour alone to show meaning ("fields in red are wrong"). Add text or an icon too.
<!DOCTYPE html>
<html lang="en">
<body>
<img src="saree.jpg" alt="Red silk saree with gold border">
<img src="divider.png" alt="">
<label for="pin">PIN code</label>
<input id="pin" inputmode="numeric" autocomplete="postal-code">
<button type="button" aria-label="Close">✕</button>
<nav aria-label="Main">
<a href="/">Home</a> <a href="/deals">Deals</a>
</nav>
</body>
</html>▶ Try it yourselfARIA - only when HTML is not enough
ARIA attributes add extra meaning for screen readers. aria-label names a button that only has an icon. aria-live="polite" makes a screen reader read out a message that changes, such as "Added to cart".
<button> is better than <div role="button">.Test it yourself
- Put the mouse away and use only Tab, Shift+Tab and Enter. Can you reach and use everything?
- Zoom the page to 200%. Does it still work?
- Use Lighthouse in Chrome DevTools to get an accessibility score.
- Accessibility means everyone can use your page.
- Alt text, labels, real buttons and good headings do most of the work.
- Use ARIA only when HTML can't express something.
- Test with the keyboard and with Lighthouse.
