Know your image tag
Wednesday April 19, 2006
There are more attributes to the img tag than just "src". And if you use them effectively, you can improve your Web site greatly.
By Jennifer Kyrnin, About.com Guide to Web Design / HTML since 1997
©2008 About.com, a part of The New York Times Company.
All rights reserved.
Comments
I usually enjoy reading your articles, but I’m dissapointed to see you recommending that designers use deprecated tag attributes without at least mentioning that. From w3schools.com:
The “align”, “border”, “hspace”, and “vspace” attributes of the image element were deprecated in HTML 4.01.
I agree with Sam and also disliked the use of “Border” to create “interesting effects”. Use CSS for this.
Furthermore you shouldn’t build whitespace into a graphic, use CSS attributes “margin” or “padding” for this.
But, perhaps most disappointing is the use of ALT to specify copyright on an image. ALT should be used for alternative information for those with a browser that cannot display graphics. It must be most irritating for say a blind person to find out who has the copyright to a picture instead of a text describing the picture.
Furthermore, browsers displaying the alt text as some kinda pop-up or tool-tip is misusing it. Saying that newer browsers does this is not fully true either, as Firefox for example dosen’t.
I believe the word you’re looking for is “element”…
The use of the alt attribute is wrong in this article.
alt is used to display alternative text when the browser is unable to display the image.
It is the title attribute (the same as for other tags) that displays the tooltip text when the mouse is moved over the image.
Internet Explorer (and only IE) incorrectly displays the alt text when the title attribute is not present.
Thanks to everyone for all the feedback on this article. I’ve made some changes to the article that address the issues you found and more. Thanks again for helping to improve the site.