Unit 6 Website Development - Tutorial 1
1.10 Add meaningful alt text to images
Continue the same static website project by making images understandable for all users.
Why Alt Text Matters
Alt text is a short description of an image. It is written in the alt attribute of the <img> element.
Screen readers can read alt text aloud, and browsers can show it if an image does not load. Good alt text helps make your static website more accessible.
Good Example
<img src="images/coding-club.jpg" alt="Students working together at a coding club">
This describes the important information in the image.
Weak And Strong Alt Text
| Weak alt text | Better alt text |
|---|---|
alt="image" |
alt="Laptop showing HTML code" |
alt="photo" |
alt="School building entrance" |
alt="logo" |
alt="School coding club logo" |
Build It Yourself
- Open the same
index.htmlfile from the previous image task. - Find your
<img>element. - Add or improve the
altattribute. - Describe the meaning of the image, not just the file name.
- If you add an image to
about.htmlorcontact.html, give that image meaningful alt text too.
Common Mistakes
- Leaving the
altattribute out completely. - Writing vague alt text such as image or picture.
- Copying the file name into the alt text.
- Writing very long alt text when a short description would be clearer.
Success Checklist
- Each meaningful image has an
altattribute. - The alt text explains what the image communicates.
- The alt text is short and clear.
- The page still displays the images correctly.
- The homepage image is accessible as well as visible.