The alt attribute provides a way to associate alt text with HTML and XHTML tags, such as img, area, and input. It is used for captioning graphics and providing anchor text for links. Alt text is important for people with low vision and is also used by search engines. The title attribute is now used for tooltip information. Alt text can be displayed instead of images in some web browsers to save bandwidth.
An alt attribute is a companion command associated with certain HTML and XHTML tags designed to provide a way to associate alt text with said tags. The most common use of this attribute is in the img tag for the purpose of captioning graphics. Some people call it an alt tag, but that’s not accurate because it’s not an html tag. The term “tag” has a distinct meaning in web design referring to the commands in angle brackets that do the actual markup in HTML. The alt attribute uses the following syntax:
The img tag is just one of many tags that accept the alt attribute. Other tags are “area” and “input”. The img tag displays an image. The area tag displays a link in an image map, and the alt attribute provides the anchor text for the link. An input tag instructs the web browser to display a text field and uses the alt text to provide the associated prompt.
Chart descriptions have historically been one of the most common uses of the alt attribute. This has been especially helpful for people with low vision, who use screen-reading software that can’t interpret an image. The primary purpose of this attribute is to provide a caption rather than to describe the associated image. An example of correct alt text would be “George Washington endured many hardships as a general during the Revolutionary War.” The actual image descriptions are the work of the title attribute.
Search engines use the text provided in the alt attribute. If a web page consists exclusively or mainly of images, the search engine spider is able to crawl the page even though the images alone are useless to search engine spiders. The alt attribute is required for the img tag in later versions of HTML, but some web developers don’t put anything in quotes. This fails to capitalize on an opportunity for better search engine optimization.
Older web browsers rendered the alt attribute as a tooltip, so web developers incorrectly used it to perform the job of a tooltip, which was supposed to provide additional information about an image, such as a description. Newer versions have corrected this problem. The title attribute is now used for this purpose and the text of this attribute can be seen by hovering over an image or link.
Web browsers that can’t display images display alt text instead. Older browsers always do this, but newer versions can be configured to only display the alt text instead of the image. This serves the purpose of saving bandwidth because the browser doesn’t have to load the image.
Protect your devices with Threat Protection by NordVPN