agyanadda@gmail.com

HTML Accessibility

HTML Best Practices 1 min read Updated Nov 30, 2026 Topic 32 of 33

Accessibility means everyone — including people who use screen readers or only a keyboard — can use your site. It also helps SEO.

Easy rules that make a big difference

  • Give every meaningful image an alt text. Use alt="" for decorative images.
  • Connect every form field to a <label>.
  • Use headings in order (h1 → h2 → h3), not just for big text.
  • Write clear link text ("Download the syllabus", not "click here").
  • Keep good colour contrast between text and background.
  • Add the lang attribute to <html>.

Example

Example — Accessible image, link and form HTML
<img src="https://www.w3schools.com/html/pic_trulli.jpg" width="200"
     alt="White stone houses with cone-shaped roofs">

<p><a href="/syllabus.pdf">Download the PHP course syllabus (PDF)</a></p>

<form>
  <label for="email">Email address</label>
  <input id="email" type="email" name="email">
  <button type="submit">Subscribe</button>
</form>

Test Yourself With Exercises

Exercise 1 Multiple Choice

Which link text is best?

Exercise 2 Fill in the Blank

Describe an image for screen readers with the ___ attribute.

Exercise 3 True / False

Decorative images should have an empty alt="".

Frequently Asked Questions

Yes. Alt text, clear headings and descriptive links help Google understand your page as well.