We are independent & ad-supported. We may earn a commission for purchases made through our links.
Advertiser Disclosure
Our website is an independent, advertising-supported platform. We provide our content free of charge to our readers, and to keep it that way, we rely on revenue generated through advertisements and affiliate partnerships. This means that when you click on certain links on our site and make a purchase, we may earn a commission. Learn more.
How We Make Money
We sustain our operations through affiliate commissions and advertising. If you click on an affiliate link and make a purchase, we may receive a commission from the merchant at no additional cost to you. We also display advertisements on our website, which help generate revenue to support our work and keep our content free for readers. Our editorial team operates independently of our advertising and affiliate partnerships to ensure that our content remains unbiased and focused on providing you with the best information and recommendations based on thorough research and honest evaluations. To remain transparent, we’ve provided a list of our current affiliate partners here.
Technology

Our Promise to you

Founded in 2002, our company has been a trusted resource for readers seeking informative and engaging content. Our dedication to quality remains unwavering—and will never change. We follow a strict editorial policy, ensuring that our content is authored by highly qualified professionals and edited by subject matter experts. This guarantees that everything we publish is objective, accurate, and trustworthy.

Over the years, we've refined our approach to cover a wide range of topics, providing readers with reliable and practical advice to enhance their knowledge and skills. That's why millions of readers turn to us each year. Join us in celebrating the joy of learning, guided by standards you can trust.

What is an Alt Attribute?

By Tony Hernandez
Updated: May 17, 2024
Views: 5,906
Share

An alt attribute is an accompanying command associated with certain HTML and XHTML tags designed to provide a way to associate alternative 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 this an alt tag, but this is not accurate because it is not an html tag. The term “tag” has a distinct meaning in web design referring to the commands between angle brackets that do the actual markup in HTML. The alt attribute uses the following syntax:

<img alt="text" src="source url">
<area alt="alt text">
<input alt="text field prompt">

The img tag is only one of several 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 tells the web browser to display a text field and uses the alt text to provide the associated prompt.

Descriptions of graphics have historically been one of the most common uses of the alt attribute. This has been especially useful to people who are visually impaired, who use software to read the screen that is not capable of interpreting a picture. The main purpose of this attribute is to provide a caption rather than to describe the associated image. An example of proper alt text would be “George Washington endured many hardships as General during the revolutionary war.” Actual image descriptions are the job of the title attribute.

Search engines make use of the text provided in the alt attribute. If a web page consists solely or primarily of pictures, the search engine spider is able to crawl the page despite the fact that images by themselves are useless to search engine spiders. The alt attribute is required for the img tag in later versions of HTML, but some web developers put nothing between the quotes. This fails to take advantage of an opportunity for better search engine optimization.

Older web browsers rendered the alt attribute as tooltips, so web developers incorrectly used it to perform the task of a tooltip, which was 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 the mouse over an image or link.

Web browsers that are not able to display images display the alt text instead. Older browsers always do this, but it is possible to configure more recent versions to display the alt text only instead of the image. This serves the purpose of saving bandwidth because the browser does not have to load the image.

Share
WiseGeek is dedicated to providing accurate and trustworthy information. We carefully select reputable sources and employ a rigorous fact-checking process to maintain the highest standards. To learn more about our commitment to accuracy, read our editorial process.

Editors' Picks

Discussion Comments
Share
https://www.wisegeek.net/what-is-an-alt-atribute.htm
Copy this link
WiseGeek, in your inbox

Our latest articles, guides, and more, delivered daily.

WiseGeek, in your inbox

Our latest articles, guides, and more, delivered daily.