Adding alt attribute to img

Hi guys,

I don’t need help but just a bit confused about the “alt” attribute e.g alt=“a funny cat looking”>

I am a bit confused as to what the alt attribute does?

Is this something the user can click on?

Thanks

HI @harryhing32 !

Welcome to the forum!

The alt attribute is supposed to provide descriptive text for the image.
It is really important for accessibility reasons.

You will learn more about accessibility in later lessons.
But it is really important there be descriptive text for screen readers.

The W3C has an in depth explanation.
https://www.w3.org/QA/Tips/altAttribute

Another reason why it is important, is because if your image fails to load then the descriptive text will show in its place.

Hey,

That’s awesome. Thank you for helping and the W3C explanation really helped.

Thanks again :slight_smile:

1 Like