Chapter 07 of 09Part 3 · Quality and launch

Web accessibility basics: pages everyone can use

What WCAG asks for, and the structure, contrast and keyboard checks that catch most accessibility problems.

9 minBy Zuzo StudioUpdated

9 min

In this chapter you will

  • learn what WCAG is and which level to aim for
  • check text contrast, alt text and keyboard focus yourself
  • run a ten minute accessibility check on your own page

Before you startThis builds on Progressive enhancement: what JavaScript is for.

Check your understanding

3 questions

Q1A photo on your page is purely decorative. What should its alt attribute be?

Show the answer

alt="" An empty alt tells assistive technology the image adds nothing, so it is skipped and the visitor hears only the content that matters.

Q2Your grey body text has a contrast ratio of 3.2:1 against white. What does that mean for WCAG AA?

Show the answer

It fails for normal text and needs to be darker Normal text needs at least 4.5:1 at AA. Darkening the grey, or making the text large, would fix it.

Q3Why is a real <button> better than a <div> with a click handler?

Show the answer

Browsers give it keyboard support and a role for free A button can be reached with Tab, pressed with Enter or Space, and is announced as a button. A div needs extra code for all of that.

Key takeaways

  1. Accessibility means people can perceive, understand, navigate and interact with a page, whatever their body or device.
  2. Semantic HTML does most of the work: headings in order, landmarks, real links and real buttons.
  3. Normal text needs a contrast ratio of at least 4.5:1 for WCAG AA, and large text at least 3:1.
  4. Never remove the focus outline without adding a visible one back, because keyboard users rely on it.
  5. Automated tools catch only part of the problem, so always Tab through the page yourself.
Up next · Chapter 08 · 8 min Website speed and Core Web Vitals explained What makes a page feel slow, the three Core Web Vitals in plain terms, and the fixes that matter most on a small site.

02FAQ

Questions on this chapter

Something else on your mind? Email the studio and a designer, not a salesperson, replies within a day.

What are the basics of web accessibility?

Use semantic HTML with headings in order, give images sensible alt text, keep text contrast at 4.5:1 or more, make everything work with a keyboard with a visible focus, and label every form field. Start there, then work through the rest of WCAG 2.2 level AA.

What level of WCAG should a website meet?

Aim for WCAG 2.2 level AA. It is the level most accessibility laws and contracts refer to, and it is achievable for any website that builds it in from the start.