The image alt description, commonly referred to as the alt tag, is a required attribute inside every image tag. The alt tag should contain a text description of the image in question. Alt is the HTML shorthand for 'Alternate Text'. On many browsers the alt description tag is displayed as text for several seconds when the mouse hovers over the top of the image. If the image cannot be retrieved by the browser the alt description tag is often displayed as text on screen in place of the image. For visually impaired users the image alt description tag is particularly useful as the description can be read aloud and give the user an idea of what the image actually shows. For these reasons an accurate and descriptive alt tag can actively assist your users in getting the most from your site's content. In addition the alt description tag is one of the elements used by search engines to index and rank your pages. According to Google's webmaster guidelines, the alt tag is used to 'process' the page content, and therefore has a role in ethical SEO and web site optimisation.
The alt description tag is written as a name and value attribute inside an image tag as follows:
<img src="myimage.jpg" alt="describe this image here" />
Despite the fact the image will display perfectly well without an alt description tag, you should always include an alt tag for every single image on your web site. It is actually a required attribute without which your page will not validate. Accordingly the latest W3C specifications state:
"To avoid problems with text-only UAs as well as to make image content understandable and navigable to users of non-visual UAs, you need to provide a description with ALT..."
As with all ethical SEO policies your focus should be on creating unique content for the human users of your site. Giving an accurate description of the images on your page will assist not only the visually impaired, or those on very slow connections who may have images switched off entirely, but is also useful for your mainstream users who will appreciate the fact they can simply mouse over the image for a little more information. The fact search engine robots and spiders also process the content of your alt description tags should be seen as an additional encouragement to give your images accurate descriptions. The images on your site will, by default, display your subject matter, and by their very nature will automatically require SEO valuable keyword rich descriptions.
On web sites that are built from a template with the same image logo repeated across the entire web site, it is permissible to include the page title or keyword description inside the logo's alt description tag, provided the logo itself is also described within the same tag. At all times however, avoid the temptation to stuff your image alt description tags full of keywords. This will simply be ignored by the search engines and may mark your site out as a possible spammer.
If your site design incorporates small empty or transparent spacer images, you may be tempted to leave out the alt description tag entirely. You should however, include an empty alt description tag instead. Empty alt tags are ignored by text browsers and text readers, whereas leaving the alt tag out entirely can encourage the text reader to attempt reading aloud the image image name and source, making the experience very frustrating for visually impaired users. The best practice is to include the alt description tag with no space at all between the quotation marks, known as an 'empty string', as follows:
<img src="blank.gif" alt="" />
Do not be tempted to leave any space between the quotation marks to show this is a blank image as the text reader will treat it the same as no alt description tag at all, and may attempt to read aloud the image name and source.