alt” attributes are NOT “alt” tags.

Phew! now that it’s out of the way lets proceed.

During team meetings I often hear developers and designers throw in the term “alt ” tags when referring to the “alt” attribute. A few years ago, I too, used to refer to the “alt” attribute as an “alt” tag. Infact, even the Human Factors International website incorrectly refers to these attributes as tags, well, they also incorrectly refer to the “longdesc” attribute as tags.

The W3c website clearly states that “alt” is an attribute  . The W3c website also contains information on what alt attributes are useful for. In short, Tags can be though of as elements and attributes as the properties these elements have.

For example, a car has four wheels, which are elements that make up the car. Now, these wheels can have properties. They may be made of iron, steel or some alloy. So if we compare the car to an HTML document, the wheel would be a tag and the attributes would be the property for that specific tag.

Alt attribute is used to display alternative text incase for some reason images cannot be rendered correctly. So if you had your company logo that did not render or display correctly, an alternative text would be displayed to indicate that the image that did not show is infact the company logo. More explaination on the use of the alt” attribute can be found on the W3c website.

Another query that often pops up at team meetings is that Alternate (alt) text for images do not show in firefox. Well, alt text in firefox is displayed only if the image is not rendered correctly or if it cannot be displayed. If the image is rendered correctly, the alt text is not not shown in Firefox. If you want a tool tip to appear when the mouse is hovered on the image, the title attribute should be used for this.

Do not confuse the title attribute with the title tag (also referred to as the title element). The title tag appears within the head tag of an HTML document and can be used only once in the entire HTML document, where as the title attribute is used as an additional explanatory note.

Hope this helps to understand the difference between (X)HTML tags and attributes.

Share

Leave A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts