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 Image Tags

question on images

why alt is used when already a link is provided for an image?

2 Answers

Andrew Young
Andrew Young
Courses Plus Student 639 Points

Alt is the text when your visitor's browser/server can't serve image successfully

Here is some details for img tag:

src the location of your image

alt the text that will show when image can't be server or show to the crawling bot (eg. google search console bot)

Brice Roberts
Brice Roberts
22,415 Points

An "alt" tag provides the text caption when you scroll over the image, or gives the user some idea of what the image is going to be, if they disable image loading by default or on metered(slow) internet connections that will no quickly load. It allows the user to understand what the image is if they cannot see it.

But, the most important reason is for Accessibility. For blind users, it gives screen reading software the capability of describing the image to the user. For this reason, you should also use as much detail as you can fit in a sentence.