Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML Introduction to HTML and CSS (2016) HTML: The Structural Foundation of Web Pages and Applications Review: Common HTML tags

Eduardo Sanchez
Eduardo Sanchez
834 Points

I am no pro developer, but how is this incorrect?

The question was: What is the alt attribute on an <img> tag for? I answered 'C': It points to a backup image.

Can someone please explain why this is wrong?

Thank you.

1 Answer

nakalkucing
nakalkucing
12,964 Points

Hi Eduardo Sanchez! The alt attribute on an <img> tag describes the image. You type in the alt attribute to give a description of your image. In the below code I describe my image with the alt attribute as "Mediterranean Islands". However, this is my own description of my selected image; it does not link to a backup image.

<header>
      <img src="images/Islands - Copy.jpg" alt="Mediterranean Islands" class="profile-image">
      <h1 class="tag name">Hi! I'm Nakal Kucing.</h1>
      <p class="tag location">My home is Lego, Brick.</p>
</header>

Does that answer your question? Please let me know if it doesn't or isn't clear.

Best and Happy Coding! :)

Eduardo Sanchez
Eduardo Sanchez
834 Points

Oh yes, this makes much more sense now, thank! In the case of your code, if the images "images/Islands - Copy.jpg" is not working, displaying, then the alt (alternative) text will display instead, not a backup image. Right?

Thank you so much!

nakalkucing
nakalkucing
12,964 Points

Right! :)

Your welcome!