Skip to content
Tutorials Center
My learning

Topics

Lesson 4 of 38 ยท Getting Started

Your First Accessible Page

Build a small accessible page step by step: language, title, landmarks, headings, labels, alt text, contrast and keyboard checks, then run a quick manual audit.

Theory is useful, but accessibility is learned by building. In this lesson you will write a small page from scratch, add one improvement at a time, and see what each one does. By the end you will have a checklist you can apply to any page, and the rest of the course will deepen each point.

Step 1: the document basics

Every page needs three things in its head: a language, a title and a viewport that lets users zoom. The lang attribute tells screen readers which pronunciation rules to use, so a French page read with an English voice sounds garbled. The <title> is the first thing announced when a page loads and the label of its browser tab.

HTML
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Opening hours - Blue Door Bakery</title>
</head>

Never add user-scalable=no or maximum-scale=1 to the viewport. That blocks pinch zoom, which low-vision users depend on.

Step 2: landmarks and headings

Use the structural elements that browsers already understand: <header>, <nav>, <main> and <footer>. There should be one <main>, and one <h1>. Headings must go in order without skipping levels, because assistive technology lists them as an outline.

Step 3: real controls with labels and alt text

Pair every field with a <label>, give every meaningful image an alt, and use <button> and <a> for actions and links. Here is the whole page together. Press Tab and use the keyboard to walk through it.

A small accessible page

Walk through what makes this page work:

  • lang, a descriptive title and a skip link at the top.
  • One <header>, <nav> with an aria-label, <main> and <footer>.
  • One <h1> followed by an <h2>.
  • Labels connected with for and id, autocomplete on the name field, and a real <button>.
  • An alt that describes the image's purpose. The image here is our sample SVG, so adapt the text to what a real photo would show.
  • A visible :focus-visible outline with strong contrast.
  • A role="status" message that is announced politely when it changes.

Step 4: text and colour

Body text should be at least 16px, with good line height and a contrast ratio of at least 4.5:1 against its background. Dark grey (#1b1b1b) on white passes easily. We cover the maths in the colour chapter, but you can already spot-check with a browser extension or the contrast checker in developer tools.

Step 5: a quick manual audit

Run these five checks on any page. They take two minutes and find a large share of real problems:

  1. Keyboard. Put the mouse aside. Press Tab repeatedly. Can you reach and operate everything, in a sensible order, always seeing where focus is?
  2. Zoom. Press Ctrl and + until the page is at 200%, then 400%. Does content still fit without horizontal scrolling and without overlap?
  3. Headings. Do the headings tell the story of the page in order?
  4. Images and links. Does every image have suitable alt, and does each link make sense out of context ("Read the menu", not "Click here")?
  5. Colour. Does anything rely only on colour, and is text clearly readable?
A tiny audit script

The deliberately flawed sample fails several checks, since the document has no lang and the second image has no alt at all. (The first image uses alt="", which is correct for decorative pictures.) Scripts like this catch only mechanical errors. They cannot judge whether an alt is meaningful or the reading order sensible, which is why manual checks come first.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Why set the lang attribute on the html element?

    Assistive technology picks a speech voice and rules from the language, so a wrong or missing value makes text sound wrong.
  2. 2. Which viewport setting hurts accessibility?

    Disabling zoom blocks users who need to enlarge content.
  3. 3. What does alt="" mean on an image?

    An empty alt marks the image as decorative; omitting the attribute entirely is the mistake.
  4. 4. Which is the best first manual test?

    Keyboard-only use quickly reveals missing focus styles, traps and unreachable controls.

Summary

  • Start with lang, a clear title and a zoomable viewport.
  • Use landmarks, one h1 and ordered headings for structure.
  • Label every field, add meaningful alt, and use real buttons and links.
  • Provide a visible focus outline and sufficient contrast.
  • Audit with keyboard, zoom, headings, links and colour before reaching for tools.

Next: The POUR Principles