freecourses.digital
Lesson progress: 0 of 3 activities done
All lessons in HTML Basics for Beginners Lesson 5.3 of 34

Module 10: Practice Project and Validation

  1. 10.1Build a simple HTML website

Alternative text and image accessibility

Inside this lesson

  • What alt text does and who uses it
  • Writing alt text for photos, products, and logos
  • Decorative images and empty alt
  • Alt text for linked images and charts

Short answer

Alt text is a short written description in the alt attribute. Screen readers read it aloud, browsers show it if the image fails to load, and search engines use it to understand images. Describe what matters in the image for this page, in about one sentence. If an image is only decoration, use an empty alt="" so screen readers skip it.

Who alt text helps

  • Blind and low vision visitors using screen readers like TalkBack, VoiceOver, or NVDA.
  • Visitors on slow data when images fail to load.
  • Search engines, which read alt text to understand image content for Google Images.

Good vs weak alt text

ImageWeakBetter
Product photoimageAbaca tote bag in natural beige with leather handles
Team photophoto of peopleAna and Ben packing pili tart orders at the bakeshop
LogologoMayon Bakeshop
InfographicchartBar chart: online orders grew from 40 in January to 120 in June

Tips: do not start with image of, since screen readers already say image. Keep it under about 125 characters. Describe what the image is doing on this page.

Decorative images

<img src="images/divider-wave.svg" alt="">

An empty alt, with nothing between the quotes, tells screen readers to skip the image. Use it for borders, background patterns, and icons next to text that already says the same thing. Never remove the alt attribute completely. Without it, some screen readers read the file name.

Linked images and complex images

<a href="/">
  <img src="images/logo.svg" alt="Mayon Bakeshop home">
</a>

When an image is the only thing inside a link, the alt text becomes the link text. Describe the destination. For charts and diagrams, put a short alt and explain the full data in nearby text or a table.

Try it: write alt text

Write alt text for each image. One is decorative, one is a linked logo, and one is a product photo. The preview shows alt text because the images do not exist.

Live preview

Quick quiz

1. Who reads alt text aloud?
2. What alt fits a decorative border?
3. Alt for a logo linking home?
4. Should alt text start with "image of"?

Common mistakes

  • Keyword stuffing alt text. Lists of keywords are spam and useless to listeners.
  • Leaving alt out. Some screen readers then read the file name.
  • Repeating the caption word for word. Listeners hear it twice.
  • Describing every tiny detail. Focus on what matters for the page.

Your action

Tick each item when you can do it. Your progress saves on this device.

Key terms

Alt text
A text alternative for an image in the alt attribute.
Screen reader
Software that reads screen content aloud.
Decorative image
An image that adds no information.
Empty alt
alt="" which hides an image from screen readers.
WCAG
Web Content Accessibility Guidelines, the main accessibility standard.

Questions beginners ask

Does alt text help SEO?

Yes, it helps Google understand images and can help in Google Images. Write it for people first.

What about images with text in them?

Put the same text in the alt, or better, use real HTML text instead of an image.

Is there a character limit?

No hard limit, but short and clear works best.

Related lessons

Need a website built or fixed while you practice? The team at Remar Digital can help.