Accessibility, checking your work and publishing
Make your pages usable by everyone with an accessibility checklist, check them with the W3C validator and Lighthouse, add search-friendly titles and descriptions, and publish free on GitHub Pages.
🎯 By the end of this lesson you will be able to:
- Check a page against a beginner accessibility checklist, including keyboard and contrast
- Validate HTML and run a Lighthouse report
- Write a good title and meta description and publish a site for free
Outline
What you'll learn and why it matters
About one in six people in the world lives with a disability. Some use a screen reader, some use only a keyboard, some need large text or strong contrast. Accessible pages work for all of them, and they are better for everyone else too: clearer, faster and easier to find in search. In many countries accessibility is also a legal requirement for business and government websites. This lesson pulls together everything you have learned into a checklist, then shows you how to share your site with the world.
A beginner accessibility checklist
| Check | How | Lesson |
|---|---|---|
| The page has a language | <html lang="en"> | 1 |
One <h1>, headings in order | No skipped levels; chosen for meaning | 2 |
| Every meaningful image has alt text | alt describes the image; decoration gets alt="" | 3 |
| Links make sense on their own | No *click here* | 3 |
| Page regions use landmarks | header, nav, main, footer | 4 |
| Every form field has a label | <label for> matches the input id | 5 |
| Text has strong contrast | At least 4.5:1 for normal text, 3:1 for large text | 6 |
| Keyboard users can see focus | A visible :focus-visible style | 7 |
| Works on a phone and when zoomed to 200% | No sideways scrolling, nothing cut off | 12 |
Test with your keyboard
Put your mouse aside and press Tab to move forward through links, buttons and form fields (Shift+Tab goes back, Enter follows a link). Ask yourself: can I reach everything? Can I always see where I am? Does the order make sense?
This is why you should use real <a> and <button> elements. A <div> styled to look like a button cannot be reached with Tab and does nothing when you press Enter.
<!-- Works with mouse, keyboard and screen readers -->
<button type="button">Add to basket</button>
<!-- Looks similar, but keyboard and screen-reader users cannot use it -->
<div class="fake-button">Add to basket</div>Browser preview
Check colour contrast
Contrast ratio compares how light the text is with its background, from 1:1 (no difference) to 21:1 (black on white). Aim for at least 4.5:1 for normal text.
.low {
color: #a3a3a3;
background-color: white;
}
.good {
color: #404040;
background-color: white;
}Show the HTML this CSS styles
<p class="low">Light grey on white: about 2.5:1. Hard to read.</p>
<p class="good">Dark grey on white: about 10:1. Easy to read.</p>Browser preview
To check a colour in Chrome or Edge: right-click the text, choose Inspect, and click the small colour square next to color in the Styles panel. The colour picker shows the contrast ratio with a tick or a warning. Firefox shows contrast in its Accessibility panel.
Validate your HTML
- Go to the W3C Markup Validation Service at
validator.w3.org. - Choose the Validate by File Upload tab and pick your
index.html(or use Validate by Direct Input and paste your code). - Click Check. Fix each error from the top down, save, and check again. Often one early mistake causes several later messages.
The validator catches unclosed tags, wrong nesting, duplicate ids and missing attributes such as alt. Every example in this course has passed an HTML validator.
Run a Lighthouse report
Lighthouse is built into Chrome and Edge. It scores a page for performance, accessibility, best practices and SEO (search engine optimisation), and lists what to fix.
- Open your page and press F12 to open the developer tools.
- Choose the Lighthouse tab (click » if you cannot see it).
- Tick the categories you want, choose Mobile, and click Analyze page load.
- Read the Accessibility section first. Each problem links to an explanation and shows which elements fail.
Help people find your page
Search engines show your page's <title> as the blue link and often its meta description as the text below it. Write both for people: say clearly what the page offers.
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Green Leaf Café, Pune | Fresh snacks and masala chai</title>
<meta name="description" content="A friendly café on Park Road, Pune, serving fresh snacks, banana bread and the best masala chai in town. Open every day 8am to 8pm.">
<link rel="stylesheet" href="styles.css">
</head>Publish your site for free (optional)
GitHub Pages hosts simple HTML and CSS sites for free. It needs a free GitHub account; everything else in this course works without one. The Git & GitHub for Beginners course teaches the professional way to do this; here is the simplest way:
- Sign up or sign in at
github.com. - Click + (top right) → New repository. Name it, for example
my-website, choose Public, and click Create repository. - On the new repository page, click uploading an existing file, drag in
index.html,styles.cssand yourimagesfolder, and click Commit changes. - Go to Settings → Pages. Under Build and deployment, choose Deploy from a branch, pick the main branch and the / (root) folder, and click Save.
- After a minute or two, the Pages settings show your address, like
https://your-username.github.io/my-website/. Open it on your phone!
Practice
Guided exercise
Fix the inaccessible snippet
The starter code has four accessibility problems: an image with no alt text, a field with no label, a vague link and a fake button. Fix them all.
<img src="images/cafe.svg" width="300" height="200">
<form action="/search" method="get">
<input type="search" id="search" name="q" placeholder="Search">
<div class="button">Search</div>
</form>
<p>To see the full menu, <a href="menu.html">click here</a>.</p>- Add an
altthat describes the image. - Add a
<label for="search">for the input. - Change *Click here* to link text that makes sense on its own.
- Replace the clickable
<div>with a real<button>.
Show the solution
<img src="images/cafe.svg" alt="A cup of masala chai on our café counter" width="300" height="200">
<form action="/search" method="get">
<label for="search">Search the menu</label>
<input type="search" id="search" name="q">
<button type="submit">Search</button>
</form>
<p><a href="menu.html">See the full menu</a></p>Browser preview
How to get there: Each fix serves a different group: alt text for screen-reader users, the label for everyone (and voice-control users), descriptive link text for people listening to a list of links, and a real button for keyboard users.
Your turn
Write a head for your about page
Write a complete <head> for about.html: charset, viewport, a clear title with your name, a meta description of about 150 characters, and the stylesheet link. Then validate the whole page at validator.w3.org.
Show the solution
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>About Asha Kumar | Junior Web Developer</title>
<meta name="description" content="Asha Kumar is a junior web developer in Pune who builds accessible, responsive websites with HTML and CSS for small businesses and charities.">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<main>
<h1>About me</h1>
<p>I build accessible, responsive websites.</p>
</main>
</body>
</html>Browser preview
How to get there: The title names the person and what they do, the description reads like a short advert for the page, and the viewport line makes it phone-friendly. The validator should report no errors.
Common mistakes
Clickable <div> or <span> elements
You see: Mouse users can click, but keyboard and screen-reader users are stuck
Fix: Use <a> to go somewhere and <button> to do something.
Light grey text for a stylish look
You see: Many people cannot read it, especially on phones outdoors
Fix: Check contrast is at least 4.5:1 in the browser's colour picker.
Trusting the score and skipping manual checks
You see: Real barriers remain even with a high Lighthouse score
Fix: Always test with the keyboard and read your alt text and headings.
Uploading files into the wrong place on GitHub
You see: Your site shows a 404 page
Fix: index.html must be at the top level of the repository, not inside another folder.
Recap
- Accessibility basics: language, headings, alt text, labels, landmarks, contrast, focus and zoom.
- Test with the keyboard: Tab through everything; use real links and buttons.
- Validate at validator.w3.org and run Lighthouse in the developer tools, then check by hand.
- Give every page a clear title and meta description; GitHub Pages can publish your site for free.
Key terms
- Accessibility
- Designing so that people with disabilities can use your site fully.
- Contrast ratio
- How different text and background brightness are, from 1:1 to 21:1.
- Validator
- A tool that checks your code against the HTML standard.
- Meta description
- A short summary of a page that search engines may show under its title.
Check your understanding
Answer all 4 questions, then check your answers to see an explanation for each one.
1. What is the minimum contrast ratio recommended for normal-size body text?
2. Why is <button> better than a clickable <div>?
3. Which tool checks your HTML against the official standard?
4. Your GitHub Pages site shows a 404 page. What is the most likely cause?
Mark this lesson complete
Finished this lesson?
When you have worked through the examples and exercises, mark it complete to save your progress.