Aral Code

Going Further Lesson 38 of 42

HTML Accessibility — Websites Everyone Can Use

Make web pages usable by everyone, including people with disabilities. Learn alt text, headings, labels, contrast, keyboard use and a simple checklist.

An accessible website can be used by everyone — including people who are blind or have low vision, who are deaf, who can't use a mouse, who are color blind, or who have learning disabilities. It also helps older users, people on slow connections, and anyone using a phone in bright sunlight. Accessibility (often shortened to a11y — "a," 11 letters, "y") is not an extra feature. It's part of doing HTML properly.

Who are we building for?

Think of real people:

  • A student with low vision who zooms the screen to 200%.
  • A blind teacher who uses a screen reader, software that reads the page aloud and is controlled by keyboard or gestures.
  • A lolo with shaky hands who finds small buttons hard to tap.
  • Someone who is color blind and can't tell red from green.
  • A student who is deaf and watches lesson videos with captions.

The good news: if you've followed the lessons on this site, you already know most of what makes a page accessible.

1. Use the right elements

Semantic HTML is the foundation. Headings in order, real <button> elements for buttons, <nav> for menus, <main> for the main content, lists for lists. Screen readers use these to announce what things are and to let users jump around.

Example A fake button vs. a real button
<!-- Bad: looks like a button, but keyboards and screen readers can't use it properly -->
<div onclick="alert('Clicked!')" style="display:inline-block; background:#0f5c4d; color:white; padding:8px 14px;">Fake button</div>

<!-- Good: works with mouse, keyboard (Tab + Enter) and screen readers -->
<button onclick="alert('Clicked!')">Real button</button>

Try pressing Tab inside the preview. The real button gets focus; the fake one is skipped entirely. A keyboard user could never press it.

2. Write alt text for images

Every <img> needs alt. Describe what's important in the image. Use alt="" for decorative images. (Review the Images lesson.)

3. Label every form field

Connect each <label> to its input with for and id. Placeholders are not labels. Group radio buttons and checkboxes in a <fieldset> with a <legend>.

4. Use good color contrast — and don't rely on color alone

Text must stand out clearly from its background. And never use color as the only way to show something:

Example Color alone vs. color + text
<p>Bad: Fields in <span style="color:red;">red</span> are required.</p>

<p>Good: Fields marked with <strong style="color:#b4372b;">* (required)</strong> must be filled in.</p>

<p>Bad: <span style="color:green;">●</span> <span style="color:red;">●</span> (Passed / Failed?)</p>
<p>Good: <span style="color:green;">✔ Passed</span> &nbsp; <span style="color:#b4372b;">✘ Failed</span></p>

About 1 in 12 men has some form of color blindness. For them, red and green dots can look nearly the same.

5. Make everything work with a keyboard

Many people navigate with Tab, Shift + Tab, Enter and Space. Test your page by putting your mouse away:

  • Can you reach every link, button and form field with Tab?
  • Can you see where you are? (Browsers draw a focus outline. Don't remove it with CSS outline: none unless you replace it with something just as visible.)
  • Is the order logical, top to bottom, left to right?

"Download the class schedule" — not "click here." Screen reader users often list all links on a page, out of context.

7. Set the page language

<html lang="en"> or <html lang="fil">. Screen readers use it to choose the right pronunciation. If one part is in another language, mark it: <p lang="fil">Maraming salamat po!</p>.

8. Captions and transcripts

Add captions to videos with <track>, and for podcasts or audio, provide a written transcript. Deaf users need them — and many other people watch videos on mute.

9. Let text grow

Use the viewport tag correctly (don't block zooming with maximum-scale=1 or user-scalable=no), use relative font sizes, and avoid putting text inside images. Users with low vision need to zoom.

ARIA — a short note

You may see attributes like aria-label or role in other people's code. ARIA adds extra accessibility information when plain HTML isn't enough, for example a button that only shows an icon:

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

The first rule of ARIA is: if a normal HTML element can do the job, use it instead. A real <button> beats <div role="button"> every time.

A quick accessibility checklist

  1. One <h1>, and headings in order.
  2. Every image has a meaningful alt (or alt="" if decorative).
  3. Every form field has a connected label.
  4. Text has strong contrast, and color is never the only signal.
  5. Everything works with the keyboard, and focus is visible.
  6. Links describe where they go.
  7. <html lang="..."> is set.
  8. Videos have captions.
  9. The page can be zoomed to 200% without breaking.

Quick Quiz

Check what you learned. Walang grade ito, practice lang. 🙂

1. Why is <button> better than a clickable <div>?
2. Which is the most accessible way to show required fields?
3. What is a screen reader?
4. What does <html lang="fil"> help with?

By Sir Reyel · Last updated 2026-12-04