Alt code


Hi, I seem to have hit a minor snag with “Alt”. Have followed the instructions carefully several times but cant seem to determine if alt text will display. Any ideas? Thanks


In 9. Alt, the lesson is not looking for you to validate that the alt description displays properly. Rather, it merely wants you to add an alt attribute and image description.

In index.html, add the alt attribute to the image. Make sure the description accurately describes the image.

What if you can to see it for yourself

But what if you want to see that “Yes, the image description does display”? How can you do that to verify what it does for yourself?

Hmm, think about what the alt attribute is and why it exists.

You know that it provides an alternative description for for an visual element such as an image. Right?

When does that description display on the screen? Let’s check MDN

It displays on the screen when

Users will see this text displayed if the image URL is wrong, the image is not in one of the supported formats, or if the image is not yet downloaded.

That means if something is wrong with the image or the URL that you typed into the src attribute is wrong, then the alt attribute displays on the screen.

To see if for yourself, change the img URL to a fake one. Since that URL doesn’t exist, you’ll see the description for the image instead.

Give it a try.

Alt attribute

Hi Tonya, thanks for taking time to respond. I took your advice and altered the Alt URL to something incorrect and yes - a description to the image was available rather than the image itself. Great help.



This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.