Welcome to the Treehouse Community
Looking to learn something new?
Robert Lin2,478 Points
What exactly is alt supposed to do? Why do we need to set it empty at times and not at other times?
difference between alt="" and alt="Facebook Logo"
Justin Black24,266 Points
Some searchers turn graphic functionality off so a page will load faster if they have a slower connection speed. When this is the case, the image will not appear, but rather the image’s alt tag will be view-able.
It’s used for blind and visually impaired readers who access a page using audio-based browsers, or screen readers. — These devices read the page aloud so the user can hear the content on the page. If there is no alt tag, the images will be skipped and important information could be lost.
Universal Search — This has been around for a few years, and is still evolving. Universal search uses alt tags and other information to display the images of your website in the “blended results”. These blended results feature images, video, news and regular listings in the search results. The search engines’ algorithm takes alt tags into account when displaying these mixed results.
Alt Tag Tips While it is important to realize that the alt tag should be used for all of the images on your site, you should not over use this tool. Abusing this tag can have serious consequences when it comes to the search results. Below are some do’s and don’ts to creating effective alt tags.
- Use on every image on your site
- Describe what the image represents
- Use keywords where applicable
- Make sure each image has a unique alt tag
- Don’t stuff all of your keywords into the tag to “game” the search engine — This is called alt spam
- Don’t add alt tags for things like buttons and images smaller than 10 x 10 pixels. These items are not necessarily important to search, so you don’t have to label them.
Jesus Mendoza23,274 Points
alt is the alternate text to be displayed if the image couldnt be loaded, so, instead seeing the image you'll see "Facebook Logo".
Hi Robert, The alt attribute is used to translate images to the visually impaired and also if you run your website through w3c validator that contains an image without an alt attribute it will not pass
Robert Lin2,478 Points
Thanks for such a quick reply guys! I have a good idea of what it does now. Thank you all for your support; really appreciate it.