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

JavaScript jQuery Basics (2014) Creating a Simple Lightbox Perform: Part 4

Should we put an alt attribute to the image on the overlay?

So, I know that it is highly recommended to put an alt attribute on each image. But we didn't do that in this video since we got an image on the overlay with only src attribute. Is this legal?

Alt atribute is used when your image is not loaded. Value of this attribute appears then and replace image. It is also good SEO feautre becasue Google Searching Bots are also using this data to describe image and rank it somehow in their databases.

Alt is never necessary attribute but it is always wise to use it becasue you lose nothing by using it and you can only gain. But yes it is completely legal to not use it. In <img> you only have to use src attribute and nothing else. Others attributes are up to you.

Ciao Amigo :-)

2 Answers

Alt atribute is used when your image is not loaded. Value of this attribute appears then and replace image. It is also good SEO feautre becasue Google Searching Bots are also using this data to describe image and rank it somehow in their databases.

Alt is never necessary attribute but it is always wise to use it becasue you lose nothing by using it and you can only gain. But yes it is completely legal to not use it. In you only have to use src attribute and nothing else. Others attributes are up to you.

Ciao Amigo :-)

Nice! Thanx Amigo!