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

CSS

Alternate Text

HI, I'm building the first website "Smells Like Bacon" and I have a weird question. I understand that I have to add the alternate text after the image file. As the example below:

<img src="img/you-bake-me-blush.gif" alt="You Bake Me Blush">

I deleted the alternate text which is alt=" You Bake Me Blush" Nothing changed the image.

So why do I need to add alternate text? What is it for?

Any help would be appreciated!

5 Answers

Check out Provide Proper Attributes for Images & Links section on the coding practices page of Shay Howe's Learn HTML & CSS Guide.

Here's a great decision tree about using alt properties

You use the alt attribute for three reasons:

1. For bad sighted people who rely on screen readers.

2. Better SEO(Search Engine Optimization).

3. If your Image fails to load the alt attribute's value takes it's place.

One of the reasons is accessibility; the ability for screen-readers, for instance, to relay a description or title of the content to those with visual impairments, etc. accessing the web with assistive devices.

When you hover over the image and see that little pice of text where your mouse is. That's what the alt is doing.

I believe you are referring to the title attribute.

Maybe. Not everything sticks to me and I get mixed up sometimes. :confused:

Thanks guys for the helpful and useful answers. That helped me a lot!

I appreciate that.