CSS Treehouse Club: CSS My First Web Page Changing Your HTML

What's the purpose of alt="Joy"?

What's the purpose of alt="Joy"? I can't see what it does... (I omitted it as an experiment and it didn't seem to make any difference.)

2 Answers

William Li
PLUS
William Li
Courses Plus Student 26,842 Points

Hi, Julian Williams

In HTML, the alt attribute adds text info to the image, and you're correct that visually it makes no difference because that alt text associated with the image doesn't get displayed; however, for people who are visually impaired that rely on screen reader to read the web page, alt info helps them understand what the image is all about, and generally speaking, it's recommended that you include alt attribute for images when coding a website for better accessibility.

For more info on alt attribute, check out this page.

Hope this helps, cheers.

Many thanks, William. Appreciated.