Web Authoring Statistics: The img element

Few surprises with the img element:

src, width, height, border, alt, align, name, hspace, vspace, usemap, title, style, id, class, onclick, onmouseover, onmouseout, valign, ismap, and onload.

It's a popular element; most pages, apparently, have an image somewhere. Most people give at least some of their images dimensions. Specifying the border is common too. Our guess (unverified) is that people are generally turning the border off (historically, images by default have a blue/purple border around them when they are part of a link).

Around three quarters of pages with images have at least one image with an alt attribute.

Comparatively few pages align their images with the align attribute. (The cynical amongst us concluded from this that most people probably put their images in tables and align the tables instead.) Even fewer give their images the hspace and vspace attributes (non-standard extensions equivalent to CSS margins). The valign attribute is virtually unused.

Image maps are not used on most pages, but they are used. In fact, nearly ten percent of pages in the sample used them, which is quite significant when you stop to think about when you last saw an image map. The numbers here map reasonably closely to the number of pages that use map and area elements, so this isn't a false positive:

usemap on img is used as ofter as name on map and coords, href, and shape on area.

The title attribute enjoys some use. We wonder, though, if, if IE stopped showing the alt attribute as a tooltip, we would see a big increase in the number of pages that used title and a big decrease in the number of pages using the alt attribute.

Something that we found interesting in this data is the relatively low number of pages that use onmouseover and onmouseout. This likely maps quite closely to the number of pages doing image rollovers. It would be interesting to compare the results one would get by segregating pages by the year of their Last-Modified headers, to see if that makes a difference.

Another attribute that is used relatively rarely is ismap. Accessibility evangelism efforts can take from these results that server-side image maps are less of a problem than, say, the use of presentational markup.

Speaking of accessibility, the longdesc attribute did register as one of the top 1000 most-used attributes, but it isn't clear whether those hits were legitimate uses or merely programs being thorough (and useless). The latter is not unheard of; for example the HTML4 DTD says that the default value of the a element's shape attribute is "rect", and so many pages actually explicitly and uselessly say <a href="..." shape="rect">. (You can see from the fact that approximately no pages use the coords attribute with the a element that in fact those cases of shape are indeed all bogus — you can see above that with the area element the coords attribute is used on more pages than shape.)