You phone Mrs. Sri and ask her to read her booking page to you. If she only says "there's some text, more text, a picture", you can't book. If she says "there's a heading Terrace Room, a photo of a double bed facing the hills, a button Book the room", you can. A screen reader is a program that reads pages aloud for blind users. In this story, the screen reader is Mrs. Sri on the phone, and you are the blind user. What a screen reader reads out is decided by your HTML (the code of the page's content), not by how the page looks.
A page that stays clear when a screen reader reads it out, as Mrs. Sri did on the phone, is called accessible. Accessibility (often shortened to a11y: the letter a, 11 letters, then y) means a page can be used by everyone. That includes people who can't see the screen, don't use a mouse, or have to enlarge the text.
Who it helps
The WHO (2023) estimates that 1.3 billion people live with significant disability: 16% of the world's population, 1 in 6 people. Some are blind and use a screen reader. Some can't use a mouse and move with the Tab key. Some have tired eyes like Mr. Hadi (58) and zoom the page.
Most sites aren't ready. WebAIM (an organisation that researches web accessibility) checked the home pages of 1 million sites (February 2026) and found WCAG failures on 95.9% of them. The six most common:
| Problem | Pages that have it |
|---|---|
| Low-contrast text | 83.9% |
| Images without alt | 53.1% |
| Form inputs without labels | 51% |
| Empty links (no name) | 46.3% |
| Empty buttons | 30.6% |
| Page language not stated | 13.5% |
Five of those six are fixed in HTML, not CSS. This lesson covers images without alt, buttons that aren't buttons, and the page language. Form labels come in the next lesson.
The accessibility tree: what a screen reader receives
The browser reads your HTML and builds an accessibility tree. It is a list of the things on the page, each with three facts:
- role: what kind of thing it is, such as button, link, heading, image.
- name: its name, such as "Book the room, pay on arrival".
- state: its condition, such as pressed or not.
A screen reader doesn't see colour or size. It only reads this tree. In Chrome you can see the tree in DevTools, Elements panel, Accessibility tab.
We built two versions of Mrs. Sri's page that look exactly the same and read their trees from Chromium 147. The div version makes the big parts of the page and the book button from <div>, a plain box with no meaning. The semantic version uses the element made for each job, which the next section covers. The Lab on this page uses the same page and shows the same tree. The "Tab stops" row counts how many elements the Tab key reaches.
| Part of the page | Div version | Semantic version |
|---|---|---|
| Header, navigation, content, footer | none, just text and links | banner, navigation "Main navigation", main, contentinfo |
| Room title | heading "Terrace Room" level 3 |
heading "Terrace Room" level 1 |
| Room photo | image "" (no name) |
image "Terrace Room: a double bed in front of a big window facing the green hills" |
| Book the room | text "Book the room, pay on arrival" |
button "Book the room, pay on arrival" |
| Tab stops | 7 (4 links, 3 night buttons) | 8 (plus the book button) |
Reading this tree is not enough. The final test is still with a real screen reader: NVDA on Windows, VoiceOver on Mac and iPhone, TalkBack on Android. We didn't run that test here.
Semantic HTML first
In the div version, the "Book the room, pay on arrival" button is a green <div> with an onclick (code that runs when it is clicked). Mouse users can book. What about keyboard and screen reader users? Guess first. The answer comes after the code below.
Semantic HTML means using the element that was made for the job: <button> for an action, <a href> to go to another page, <h1> to <h6> for headings. The big parts of the page use landmarks (jump points): elements that mark a part that screen reader users can go to directly. This is the semantic version of Mrs. Sri's page:
<header class="top">
<p class="logo">Mist Homestay</p>
<nav aria-label="Main navigation">
<a href="#home">Home</a>
<a href="#rooms" aria-current="page">Rooms</a>
</nav>
</header>
<main class="mist">
<h1 class="title">Terrace Room</h1>
<img class="mist-line" src="mist.svg" alt="">
<img class="photo" src="terrace-room.svg" alt="Terrace Room: a double bed in front of a big window facing the green hills" width="320" height="150">
<p class="price">$35 / night</p>
<button class="book">Book the room, pay on arrival</button>
<h2 class="sub">House rules</h2>
<p class="note">Free cancellation up to 3 days before check-in.</p>
</main>
<footer class="foot">Mist Homestay, Mountain village</footer>
<header>,<nav>,<main>,<footer>become landmarks with the roles banner, navigation, main and contentinfo. Screen reader users can jump straight to a landmark, for example straight to the main content without hearing the menu first.<nav>sits inside<header>, because the site navigation is part of the page head (the header). A page has only one<main>.<button>can be focused with Tab, pressed with Enter or Space, and is read out by a screen reader as "button", all on its own.- The heading size comes from the
class, not the tag. So picking<h1>or<h2>is about structure, and the look stays the same.
So the answer to the guess: keyboard users can't reach that button, because a <div> never gets a turn in the Tab order. A screen reader also only receives text "Book the room, pay on arrival", not a button.
ARIA: when HTML isn't enough
ARIA stands for Accessible Rich Internet Applications. ARIA is a W3C specification (a document of rules), with attributes that change the accessibility tree:
rolechanges what kind of thing it is, such asrole="button".aria-labelgives a name.- State attributes, such as
aria-pressed(pressed or not) oraria-current(marks the link to the page that is open now), change its condition.
ARIA doesn't change behaviour. A div given role="button" does become a button in Chromium's tree. But it still can't be focused, and Enter or Space don't press it.
That's why W3C has a first rule of ARIA: if a native HTML element already has the meaning and behaviour you need, use that element. ARIA is for what HTML has no equivalent for, such as aria-pressed on the night buttons. WebAIM found that home pages using ARIA actually averaged more errors (59.1) than those without (42).
Alt text: informative or decoration
The alt attribute on <img> is the image's name in the tree. To choose what to write, ask: if the image were gone, what would the page lose?
| Case | Write | In Chromium's tree |
|---|---|---|
| The Terrace Room photo: helps the guest decide | alt="Terrace Room: a double bed in front of a big window..." |
image with that name |
| The mist line under the title: only decoration | alt="" |
gone from the tree, not read out |
| Forgot the alt | (no alt attribute) | image "": an image, no name |
- For a decorative image (decoration), write
alt=""(an empty alt), and don't drop the attribute. Without it, a screen reader knows there's an image but not what it shows, and some screen readers then read out the file name. - Write what is seen and matters, briefly. No need to start with "image" or "photo", since the role is already image.
- When an image is the only content of a link (such as a logo that goes to Home), its alt becomes the link's name. So write where the link goes.
In the exercise, the starter is a <div class="header"> holding a <div class="nav">, then a <div class="content"> with <h3>Welcome</h3>, <img src="hero.jpg" /> without an alt, and <h1>About Us</h1>. Replace those divs with <header>, a <nav> inside it, and <main>. Give the image an alt that describes it (not an empty alt). Then make Welcome an <h1> and About Us an <h2>.
Headings in order and the page language
Screen reader users often jump from heading to heading to learn what a page holds, like reading a table of contents. So the order has to make sense: one <h1> for the page title, then <h2> for its sections, <h3> for smaller parts under an <h2>, without skipping a level. The div version of Mrs. Sri's page starts at h3 and then goes to h1. WebAIM found skipped heading levels on 41.8% of home pages.
<html lang="en"> states the page's language (WCAG 3.1.1, Language of Page). <html> is the outermost element of the page, and the lang attribute holds the language code. As the WCAG explanation puts it, a screen reader can then use the right pronunciation rules. Without lang, the sentence "Free cancellation up to 3 days" may be read in another language's accent. A page in French uses lang="fr".
Zoom 200% and a 320px screen
Mr. Hadi zooms the page so he can read the text. Two WCAG level AA criteria cover this:
- 1.4.4 Resize Text: text can be enlarged up to 200% with no content or function lost.
- 1.4.10 Reflow: content stays readable without scrolling sideways at a width equivalent to 320 CSS px. That is the same as a 1,280px wide screen zoomed to 400%, or a small phone.
We opened Mrs. Sri's page at 320px wide in Chromium, WebKit and Firefox. max-width is a maximum width, while width is a fixed width. With max-width: 320px, the card shrinks and the page stays 320px. With width: 320px, the card stays 362px wide (320px plus padding and border), the page becomes 378px, and the guest has to scroll sideways 58px for every line. So use max-width, not a fixed width.
⚠️ Looks fine, but not everyone can use it
- A
<div>or<span>with anonclick. The mouse can use it, the keyboard and screen readers can't. Use<button>. - Adding ARIA before using the right HTML.
role="button"doesn't make a div focusable. First rule of ARIA: the native element first. - An empty alt on an informative photo, or no alt on decoration. The room photo needs an alt that describes it. A decorative line needs
alt="". In the exercise, an empty alt on the main image is rejected. - Picking a heading by its size. The page title is an
<h1>even if it looks small. Set the size with CSS. - Forgetting
langon<html>. One attribute is enough, and the screen reader knows the page's language.
TL;DR: Accessibility means everyone can use the page. 1 in 6 people worldwide lives with a disability (WHO 2023), and 95.9% of home pages in the WebAIM Million 2026 (a check of 1 million sites' home pages) still fail WCAG. A screen reader is a program that reads pages aloud for blind users. It reads the accessibility tree: a list the browser builds from your HTML, with the role (kind), name and state (condition) of each thing on the page. Semantic HTML (the element made for the job) first: <header> (role banner), a <nav> inside it (role navigation), one <main>, <footer>, and <button> for actions, because a <div onclick> can't be focused. ARIA attributes (Accessible Rich Internet Applications) only change the tree, not the behaviour: a div with role="button" still can't be focused. So use the native HTML element when there is one. Informative images get an alt (the image's name that is read out) that describes them, and decorative ones get alt="". An image with no alt becomes image "": an image with no name. Headings in order: one <h1>, then <h2>, no skipping. <html lang="en"> states the language. The page must stay whole at 200% zoom (WCAG 1.4.4) and need no sideways scrolling at 320px (WCAG 1.4.10): use max-width, not a fixed width. The final test is a real screen reader.
⚡ A screen reader reads the tree
Meaning: A screen reader is a program that reads pages aloud for blind users. The browser builds an accessibility tree from your HTML: each thing on the page has a role (what kind of thing: button, link, heading), a name and a state (its condition). A screen reader doesn't see colour or size, it only reads this tree.
⚡ Semantic HTML first
Write:
<header class="top">
<nav aria-label="Main navigation">
<a href="#rooms" aria-current="page">Rooms</a>
</nav>
</header>
<main class="mist">
<h1 class="title">Terrace Room</h1>
<button class="book">Book the room, pay on arrival</button>
</main>
Guess first: in another version, the book button is a green <div> (a plain box with no meaning) with an onclick (code that runs when it is clicked). Can keyboard and screen reader users book?
No. A <div> never gets a turn in the Tab order, and a screen reader only receives plain text, not a button.
Meaning: <header>, <nav>, <main> and <footer> become landmarks, parts of the page that screen reader users can go to directly. A <button> can be focused and pressed with Enter or Space on its own. ARIA is a set of attributes that only change the accessibility tree, not the behaviour (whether it can be focused and pressed). The first rule of ARIA: if an HTML element exists for it, use that element.
⚡ Alt: informative or decoration
Write:
<img class="mist-line" src="mist.svg" alt="">
<img class="photo" src="terrace-room.svg" alt="Terrace Room: a double bed in front of a big window facing the green hills" width="320" height="150">
Meaning: alt is the image's name that a screen reader reads out. The room photo helps the guest decide, so its alt describes it. The mist line (mist.svg) is only decoration, so alt="". Don't drop the attribute: without an alt, the image becomes image "" in the tree, an image with no name.
⚡ Headings, language and zoom
Meaning: One <h1>, then <h2>, without skipping a level. <html lang="en"> states the page's language, so a screen reader uses the right pronunciation. Use max-width (a maximum width), not a fixed width, so at 320px wide (a small phone, or a screen zoomed to 400%) the page needs no sideways scrolling.