Yesterday I mentioned the ‘title’ attribute (not ‘tag’!) for web page elements, and that it was just one of four attributes for images offered in WordPress and other content management systems. Inevitably, someone emailed in to ask about the others. I’d already covered the ‘alt’ attribute (definitely use this); but we need to talk about ‘caption’ and ‘description’.
The caption is not an HTML attribute for your image. It’s something which the design theme you’re using may put alongside the image as a conventional caption. Try it; if a caption appears on the page, your theme supports that feature. If it doesn’t, your theme doesn’t use captions, and you’re wasting your time including one, unless you think you might change the design in the future and the new theme might use the feature.
The description is perhaps even more peripheral. In WordPress (and I’m guessing some other content management systems), every image gets its own page. You may never have come across this, but unless your site turns off the feature, it exists! Indeed, there’s an options box where you can specify that an image links to its own page, although on a conventional business website I can’t imagine why you’d do this. That’s where you’ll find the description field: on the image’s own page, describing what’s in the image.
Alt, Title, Caption and Description
Here’s an example of an image with all four fields completed (if you’re reading the email version of this post you’ll need to click through to the web version).
The ‘alt‘ attribute for the image has been set as “an otter looking cute”, which should be what’s read out by a screen reader (a software application that enables people with severe visual impairments to use a computer). Crucially, it’ll also be read by search engines. There’s a title which may be shown if you hover over the image, depending on your browser, but most people will never see this. Things have been set up so that clicking on the image takes you to the image’s own page, which is the only place you’ll see the description, and may be the only place you’ll see the title. Try it. Finally, the theme used on the website does include captions, so you can see the one we’ve specified, under the image.