Abstract

This document contains best practice guidance for authors of HTML [HTML5] documents on providing text alternatives for images.

Status of This Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

It was developed through the HTML Accessibility Taskforce, and is published by the HTML Working Group with approval by the Protocols and Formats Working Group.

It is a draft document and its contents are subject to change without notice.

This document was published by the HTML Working Group as a Working Draft.

It is expected to be published as a W3C Working Group Note.

Following feedback on the last Working Draft, a number of bugs were raised and resolved. Other bugs are still under consideration, these include the provision of examples using the longdesc attribute for longer text alternatives: bug 26868 and bug 18450. If you wish to make comments regarding this document, please send them to public-html@w3.org (subscribe, archives). All comments are welcome. Bugs can also be filed directly into the W3C Bug tracker for this specification.

Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

This document is governed by the 1 August 2014 W3C Process Document.

Table of Contents

1. Requirements for providing text to act as an alternative for images

Text alternatives,[WCAG] are a primary way of making visual information accessible, because they can be rendered through any sensory modality (for example, visual, auditory or tactile) to match the needs of the user. Providing text alternatives allows the information to be rendered in a variety of ways by a variety of user agents. For example, a person who cannot see a picture can have the text alternative read aloud using synthesized speech.

The alt attribute on images is a very important accessibility attribute. Authoring useful alt attribute content requires the author to carefully consider the context in which the image appears and the function that image may have in that context. The guidance included here addresses the most common ways authors use images. Additional guidance and techniques are available in Resources on Alternative Text for Images.

1.1 Examples of scenarios where users benefit from text alternatives for images

1.2 General guidelines

Except where otherwise specified, the alt attribute must be specified and its value must not be empty; the value must be an appropriate functional replacement for the image. The specific requirements for the alt attribute content depend on the image's function in the page, as described in the following sections.

To determine an appropriate text alternative it is important to think about why an image is being included in a page. What is its purpose? Thinking like this will help you to understand what is important about the image for the intended audience. Every image has a reason for being on a page, because it provides useful information, performs a function, labels an interactive element, enhances aesthetics or is purely decorative. Therefore, knowing what the image is for, makes writing an appropriate text alternative easier.

1.4 Graphical Representations: Charts, diagrams, graphs, maps, illustrations

Users can benefit when content is presented in graphical form, for example as a flowchart, a diagram, a graph, or a map showing directions. Users also benefit when content presented in a graphical form is also provided in a textual format, these users include those who are unable to view the image (e.g. because they have a very slow connection, or because they are using a text-only browser, or because they are listening to the page being read out by a hands-free automobile voice Web browser, or because they have a visual impairment and use an assistive technology to render the text to speech).

In the following example we have an image of a pie chart, with text in the alt attribute representing the data shown in the pie chart:

Browser Share: Internet Explorer 25%, Firefox 40%, Chrome 25%, Safari 6% and Opera 4%.

<img src="piechart.gif" alt="Pie chart: Browser Share - Internet Explorer 25%, 
Firefox 40%, Chrome 25%, Safari 6% and Opera 4%.">    

In the case where an image repeats the previous paragraph in graphical form. The alt attribute content labels the image.

<p>According to a recent study Firefox has a 40% browser share, Internet Explorer has 25%, 
Chrome has 25%, Safari has 6% and Opera has 4%.</p>   
<p><img src="piechart.gif" alt="Pie chart representing the data in the previous paragraph."></p>

It can be seen that when the image is not available, for example because the src attribute value is incorrect, the text alternative provides the user with a brief description of the image content:

Representation of the code snippet above.

In cases where the text alternative is lengthy, more than a sentence or two, or would benefit from the use of structured markup, provide a brief description or label using the alt attribute, and an associated text alternative.

Here's an example of a flowchart image, with a short text alternative included in the alt attribute, in this case the text alternative is a description of the link target as the image is the sole content of a link. The link points to a description, within the same document, of the process represented in the flowchart.

Flowchart: Dealing with a broken lamp.

<a href="#desc"><img src="flowchart.gif" alt="Flowchart: Dealing with a broken lamp."></a>      
...      
...      
<div id="desc">    
<h2>Dealing with a broken lamp</h2>    
<ol>    
<li>Check if it's plugged in, if not, plug it in.</li>    
<li>If it still doesn't work; check if the bulb is burned out. If it is, replace the bulb.</li>    
<li>If it still doesn't work; buy a new lamp.</li>    
</ol>    
</div>

In this example, there is an image of a chart. It would be inappropriate to provide the information depicted in the chart as a plain text alternative in an alt attribute as the information is a data set. Instead a structured text alternative is provided below the image in the form of a data table using the data that is represented in the chart image.

Bar Chart showing average rainfall in millimetres by Country and Season.

Indications of the highest and lowest rainfall for each season have been included in the table, so trends easily identified in the chart are also available in the data table.

Average rainfall in millimeters by country and season.
United Kingdom Japan Australia
Spring 5.3 (highest) 2.4 2 (lowest)
Summer 4.5 (highest) 3.4 2 (lowest)
Autumn 3.5 (highest) 1.8 1.5 (lowest)
Winter 1.5 (highest) 1.2 1 (lowest)

<figure role="group" aria-labelledby="caption">
<img src="rainchart.gif" alt="Bar chart: Average rainfall in millimeters by Country and Season.">    
<table>    
<caption id="caption">Rainfall in millimeters by Country and Season.</caption>    
<tr><td><th scope="col">UK <th scope="col">Japan<th scope="col">Australia</tr>    
<tr><th scope="row">Spring <td>5.5 (highest)<td>2.4 <td>2 (lowest)</tr>    
<tr><th scope="row">Summer <td>4.5 (highest)<td>3.4<td>2 (lowest)</tr>    
<tr><th scope="row">Autumn <td>3.5 (highest) <td>1.8 <td>1.5 (lowest)</tr>    
<tr><th scope="row">Winter <td>1.5 (highest) <td>1.2 <td>1 lowest</tr>    
</table>
</figure>    

Images of text

Sometimes, an image only contains text, and the purpose of the image is to display text using visual effects and /or fonts. It is strongly recommended that text styled using CSS be used, but if this is not possible, provide the same text in the alt attribute as is in the image.

This example shows an image of the text "Get Happy!" written in a fancy multi colored freehand style. The image makes up the content of a heading. In this case the text alternative for the image is "Get Happy!".

Get Happy!

<h1><img src="gethappy.gif" alt="Get Happy!"></h1>

In this example we have an advertising image consisting of text, the phrase "The BIG sale" is repeated 3 times, each time the text gets smaller and fainter, the last line reads "...ends Friday" In the context of use, as an advertisement, it is recommended that the image's text alternative only include the text "The BIG sale" once as the repetition is for visual effect and the repetition of the text for users who cannot view the image is unnecessary and could be confusing.

The big sale ...ends Friday.

  <p><img src="sale.gif" alt="The BIG sale ...ends Friday."></p>    

In situations where there is also a photo or other graphic along with the image of text, ensure that the words in the image text are included in the text alternative, along with any other description of the image that conveys meaning to users who can view the image, so the information is also available to users who cannot view the image.

When an image is used to represent a character that cannot otherwise be represented in Unicode, for example gaiji, itaiji, or new characters such as novel currency symbols, the text alternative should be a more conventional way of writing the same thing, e.g. using the phonetic hiragana or katakana to give the character's pronunciation.

In this example from 1997, a new-fangled currency symbol that looks like a curly E with two bars in the middle instead of one is represented using an image. The alternative text gives the character's pronunciation.

Only euro 5.99!

<p>Only <img src="euro.png" alt="euro ">5.99!

An image should not be used if Unicode characters would serve an identical purpose. Only when the text cannot be directly represented using Unicode, e.g. because of decorations or because the character is not in the Unicode character set (as in the case of gaiji), would an image be appropriate.

If an author is tempted to use an image because their default system font does not support a given character, then Web Fonts are a better solution than images.

An illuminated manuscript might use graphics for some of its letters. The text alternative in such a situation is just the character that the image represents.

Once upon a time and a long long time ago...

<p><img src="initials/fancyO.png" alt="O">nce upon a time and a long long time ago...

1.5 Images that include text

Sometimes, an image consists of a graphics such as a chart and associated text. In this case it is recommended that the text in the image is included in the text alternative.

Consider an image containing a pie chart and associated text. It is recommended wherever possible to provide any associated text as text, not an image of text. If this is not possible include the text in the text alternative along with the pertinent information conveyed in the image.

Figure 1. Distribution of Articles by Journal     Category. Pie chart: Language=68%, Education=14% and Science=18%.

<p><img src="figure1.gif" alt="Figure 1. Distribution of Articles by Journal Category.     
Pie chart: Language=68%, Education=14% and Science=18%."></p>    

Here's another example of the same pie chart image, showing a short text alternative included in the alt attribute and a longer text alternative in text. The figure and figcaption elements are used to associate the longer text alternative with the image. The alt attribute is used to label the image.

<figure>    
<img src="figure1.gif" alt="Figure 1">    
<figcaption><strong>Figure 1.</strong> Distribution of Articles by Journal Category.     
Pie chart: Language=68%, Education=14% and Science=18%.</figcaption>    
</figure>    

The advantage of this method over the previous example is that the text alternative is available to all users at all times. It also allows structured mark up to be used in the text alternative, where as a text alternative provided using the alt attribute does not.

1.6 Images that enhance the themes or subject matter of the page content

An image that isn't discussed directly by the surrounding text but still has some relevance can be included in a page using the img element. Such images are more than mere decoration, they may augment the themes or subject matter of the page content and so still form part of the content. In these cases, it is recommended that a text alternative be provided.

Here is an example of an image closely related to the subject matter of the page content but not directly discussed. An image of a painting inspired by a poem, on a page reciting that poem. The following snippet shows an example. The image is a painting titled the "Lady of Shallot", it is inspired by the poem and its subject matter is derived from the poem. Therefore it is strongly recommended that a text alternative is provided. There is a short description of the content of the image in the alt attribute and a link below the image to a longer description located at the bottom of the document. At the end of the longer description there is also a link to further information about the painting.

A painting inspired by Alfred Tennyson's poem The Lady of Shalott

<header>
<h1>The Lady of Shalott</h1>    
<p>A poem by Alfred Lord Tennyson</p>
</header>
<img src="shalott.jpeg" alt="Painting of a  young woman with long hair, sitting in a wooden boat. ">
<p><a href="#des">Description of the painting</a>.</p>       
<!-- Full Recitation of Alfred, Lord Tennyson's Poem.  -->      
...   
...    
...    
<p id="des">The woman in the painting is wearing a flowing white dress. A large piece of intricately     
patterned fabric is draped over the side. In her right hand she holds the chain mooring the boat. 
Her expression is mournful. She stares at a crucifix lying in front of her. Beside it are three candles. 
Two have blown out. <a href="http://bit.ly/5HJvVZ">Further information about the painting</a>.</p>    

This example illustrates the provision of a text alternative identifying an image as a photo of the main subject of a page.

Portrait photo(black and white) of Robin, accompanied by a heading 'Robin Berjon' and a question    'what more needs to be said?'
<img src="orateur_robin_berjon.png" alt="Portrait photo(black and white) of Robin.">
<h1>Robin Berjon</h1>    
<p>What more needs to be said?</p>    

1.7 A graphical representation of some of the surrounding text

In many cases, the image is actually just supplementary, and its presence merely reinforces the surrounding text. In these cases, the alt attribute must be present but its value must be the empty string.

In general, an image falls into this category if removing the image doesn't make the page any less useful, but including the image makes it a lot easier for users of visual browsers to understand the concept.

It is not always easy to write a useful text alternative for an image, another option is to provide a link to a description or further information about the image when one is available.

In this example of the same image, there is a short text alternative included in the alt attribute, and there is a link after the image. The link points to a page containing information about the painting.

The Lady of Shalott
A poem by Alfred Lord Tennyson.

Painting of a woman in a white flowing dress, sitting in a small boat.

About this painting.

Full recitation of Alfred, Lord Tennyson's poem.

<header>
<h1>The Lady of Shalott</h1>    
<p>A poem by Alfred Lord Tennyson</p>
</header>    
<figure>
<img src="shalott.jpeg" alt="Painting of a woman in a white flowing dress, sitting in a small boat."> 
<p><a href="http://bit.ly/5HJvVZ">About this painting.</a></p>    
</figure>    

<!-- Full Recitation of Alfred, Lord Tennyson's Poem.  -->    

1.8 A purely decorative image that doesn't add any information

Purely decorative images are visual enhancements, decorations or embellishments that provide no function or information beyond aesthetics to users who can view the images.

Mark up purely decorative images so they can be ignored by assistive technology by using an empty alt attribute (alt=""). While it is not unacceptable to include decorative images inline, it is recommended if they are purely decorative to include the image using CSS.

Here's an example of an image being used as a decorative banner for a person's blog, the image offers no information and so an empty alt attribute is used.

Clara's Blog

Welcome to my blog...

<header>
<div><img src="border.gif" alt="" width="400" height="30"></div>
<h1>Clara's Blog</h1>
</header>    

<p>Welcome to my blog...</p>    

1.9 Inline images

When images are used inline as part of the flow of text in a sentence, provide a word or phrase as a text alternative which makes sense in the context of the sentence it is apart of.

I love you.

I <img src="heart.png" alt="love"> you.

My heart breaks.

My <img src="heart.png" alt="heart"> breaks.
Note

Unicode characters could be used as an alternative to inline images where appropriate. Modern browsers have support for characters like "♥" and "☺", and support the use of custom fonts to render those as colored image fonts, or an author can use image replacement techniques.

1.11 Image maps

If an img element has a usemap attribute which references a map element containing area elements that have href attributes, the img is considered to be interactive content. In such cases, always provide a text alternative for the image using the alt attribute.

Consider the following image which is a map of Katoomba, it has 2 interactive regions corresponding to the areas of North and South Katoomba:

Map of Katoomba.

North Katoomba South Katoomba

The text alternative is a brief description of the image. The alt attribute on each of the area elements provides text describing the content of the target page of each linked region:

<p>View houses for sale in North Katoomba or South Katoomba:</p>   
<p><img src="imagemap.png" width="209" alt="Map of Katoomba" height="249" usemap="#Map">     

<map name="Map">
<area shape="poly" coords="78,124,124,10,189,29,173,93,168,132,136,151,110,130" href="north.html" 
alt="Houses in North Katoomba">
<area shape="poly" coords="66,63,80,135,106,138,137,154,167,137,175,133,144,240,49,223,17,137,17,61" 
alt="Houses in South Katoomba" href="south.html">   
</map> 
Note

Generally, slicing an image for links should be used instead of image maps as fallback support for image maps is poorly supported.

1.13 Images of Pictures

Images of pictures or graphics include visual representations of objects, people, scenes, abstractions, etc. This non-text content,[WCAG] can convey a significant amount of information visually or provide a specific sensory experience,[WCAG] to a sighted person. Examples include photographs, paintings, drawings and artwork.

An appropriate text alternative for a picture is a brief description, or name[WCAG]. As in all text alternative authoring decisions, writing suitable text alternatives for pictures requires human judgment. The text value is subjective to the context where the image is used and the page author's writing style. Therefore, there is no single 'right' or 'correct' piece of alt text for any particular image. In addition to providing a short text alternative that gives a brief description of the non-text content, also providing supplemental content through another means when appropriate may be useful.

This first example shows an image uploaded to a photo-sharing site. The photo is of a cat, sitting in the bath. The image has a text alternative provided using the img element's alt attribute. It also has a caption provided by including the img element in a figure element and using a figcaption element to identify the caption text.

Lola the cat sitting under an umbrella in the bath tub.

Lola prefers a bath to a shower.

<figure>
<img src="664aef.jpg" alt="Lola the cat sitting under an umbrella in the bath tub.">
<figcaption>Lola prefers a bath to a shower.</figcaption>
</figure>    

This example is of an image that defies a complete description, as the subject of the image is open to interpretation. The image has a text alternative in the alt attribute which gives users who cannot view the image a sense of what the image is. It also has a caption provided by including the img element in a figure element and using a figcaption element to identify the caption text.

An abstract, freeform, vertically symmetrical, black inkblot on a light background.

The first of the ten cards in the Rorschach test.

<figure>
<img src="Rorschach1.jpg" 
alt="An abstract, freeform, vertically symmetrical, black inkblot on a light background.">
<figcaption>The first of the ten cards in the Rorschach test.</figcaption>
</figure> 

1.14 Webcam images

Webcam images are static images that are automatically updated periodically. Typically the images are from a fixed viewpoint, the images may update on the page automatically as each new image is uploaded from the camera or the user may be required to refresh the page to view an updated image. Examples include traffic and weather cameras.

This example is fairly typical; the title and a time stamp are included in the image, automatically generated by the webcam software. It would be better if the text information was not included in the image, but as it is part of the image, include it as part of the text alternative. A caption is also provided using the figure and figcaption elements. As the image is provided to give a visual indication of the current weather near a building, a link to a local weather forecast is provided, as with automatically generated and uploaded webcam images it may be impractical to provide such information as a text alternative.

The text of the alt attribute includes a prose version of the timestamp, designed to make the text more understandable when announced by text to speech software. The text alternative also includes a description of some aspects of what can be seen in the image which are unchanging, although weather conditions and time of day change.

Sopwith house weather cam. Taken on the 21/04/10 at 11:51 and 34 seconds. In the foreground are the safety    rails on the flat part of the roof. Nearby ther are low rise industrial buildings, beyond those are block of flats. In the distance there's a    church steeple.

View from the top of Sopwith house, looking towards North Kingston. This image is updated every hour.

View the latest weather details for Kingston upon Thames.

<figure>    
<img src="webcam1.jpg" alt="Sopwith house weather cam. Taken on the 21/04/10 at 11:51 and 34 seconds.    
In the foreground are the safety rails on the flat part of the roof. Nearby there are low rise industrial
buildings, beyond are blocks of flats. In the distance there's a church steeple.">    
<figcaption>View from Sopwith house, looking towards north Kingston. 
This image is updated every hour.</figcaption>    
</figure>    
<p>View the <a href="http://news.bbc.co.uk/weather/forecast/4296?area=Kingston">latest weather details</a> 
for Kingston upon Thames.</p>    

1.15 When a text alternative is not available at the time of publication

In some cases an image is included in a published document, but the author is unable to provide an appropriate text alternative. In such cases the minimum requirement is to provide a caption for the image using the figure and figcaption elements under the following conditions:

In other words, the only content of the figure is an img element and a figcaption element, and the figcaption element must include (caption) content.

Such cases are to be kept to an absolute minimum. If there is even the slightest possibility of the author having the ability to provide real alternative text, then it would not be acceptable to omit the alt attribute.

In this example, a person uploads a photo, as part of a bulk upload of many images, to a photo sharing site. The user has not provided a text alternative or a caption for the image. The site's authoring tool inserts a caption automatically using whatever useful information it has for the image. In this case it's the file name and date the photo was taken.

The caption text in the example below is not a suitable text alternative and is not conforming to the Web Accessibility Guidelines 2.0. [WCAG20]

no text alternative provided

clara.jpg, taken on 12/11/2010.

<figure>    
<img src="clara.jpg">    
<figcaption>clara.jpg, taken on 12/11/2010.</figcaption>    
</figure>    

Notice that even in this example, as much useful information as possible is still included in the figcaption element.

In this second example, a person uploads a photo to a photo sharing site. She has provided a caption for the image but not a text alternative. This may be because the site does not provide users with the ability to add a text alternative in the alt attribute.

no text alternative provided

Eloisa with Princess Belle

<figure>    
<img src="elo.jpg">    
<figcaption>Eloisa with Princess Belle</figcaption>    
</figure>    

Sometimes the entire point of the image is that a textual description is not available, and the user is to provide the description. For example, software that displays images and asks for alternative text precisely for the purpose of then writing a page with correct alternative text. Such a page could have a table of images, like this:

<table>    
<tr><tr> 
<th> Image 
<th> Description
<tr>    
<td>    
<figure>    
<img src="2421.png">    
<figcaption>Image 640 by 100, filename 'banner.gif'</figcaption>    
</figure>    
<td> <input name="alt2421">    
<tr>    
<td> 
<figure>    
<img src="2422.png">    
<figcaption>Image 200 by 480, filename 'ad3.gif'</figcaption>    
</figure>    
<td> <input name="alt2422">    
</table>
Note

Since some users cannot use images at all (e.g. because they are blind) the alt attribute is only allowed to be omitted when no text alternative is available and none can be made available, as in the above examples.

1.16 An image not intended for the user

Generally authors should avoid using img elements for purposes other than showing images.

If an img element is being used for purposes other than showing an image, e.g. as part of a service to count page views, use an empty alt attribute.

An example of an img element used to collect web page statistics. The alt attribute is empty as the image has no meaning.

<img src="http://server3.stats.com/count.pl?NeonMeatDream.com" width="0" height="0" alt="">    

It is recommended for the example use above the width and height attributes be set to zero.

Another example use is when an image such as a spacer.gif is used to aid positioning of content. The alt attribute is empty as the image has no meaning.

<img src="spacer.gif" width="10" height="10" alt="">
Note

It is recommended that that CSS be used to position content instead of img elements.

1.17 Icon Images

An icon is usually a simple picture representing a program, action, data file or a concept. Icons are intended to help users of visual browsers to recognize features at a glance.

Use an empty alt attribute when an icon is supplemental to text conveying the same meaning.

In this example, we have a link pointing to a site's home page, the link contains a house icon image and the text "home". The image has an empty alt text. Where images are used in this way, it would also be appropriate to add the image using CSS

A house icon next to the word 'home'.

<a href="home.html"><img src="home.gif" width="15" height="15" alt="">Home</a> 

#home:before { content: url(home.png);}      

<a href="home.html" id="home">Home</a>    

In this example, there is a warning message, with a warning icon. The word "Warning!" is in emphasized text next to the icon. As the information conveyed by the icon is redundant the img element is given an an empty alt attribute.

Warning!Warning! Your session is about to expire.

<p><img src="warning.png" width="15" height="15" alt="">
<strong>Warning!</strong> Your session is about to expire</p>

When an icon conveys additional information not available in text, provide a text alternative.

In this example, there is a warning message, with a warning icon. The icon emphasizes the importance of the message and identifies it as a particular type of content.

Warning!Your session is about to expire.

<p><img src="warning.png" width="15" height="15" alt="Warning!"> 
  Your session is about to expire</p>

1.18 Logos, insignia, flags, or emblems

Many pages include logos, insignia, flags, or emblems, which stand for a company, organization, project, band, software package, country, or other entity. What can be considered as an appropriate text alternative depends upon, like all images, the context in which the image is being used and what function it serves in the given context.

If a logo is the sole content of a link, provide a brief description of the link target in the alt attribute.

This example illustrates the use of the HTML5 logo as the sole content of a link to the HTML specification.

HTML 5.1 Nightly specification

<a href="http://dev.w3.org/html5/spec/spec.html"><img src="HTML5_Logo.png" alt="HTML 5.1 specification"></a>

If a logo is being used to represent the entity, e.g. as a page heading, provide the name of the entity being represented by the logo as the text alternative.

This example illustrates the use of the WebPlatform.org logo being used to represent itself.

WebPlatform.org and other developer resources

<h2><img src="images/webplatform.png" alt="WebPlatform.org"> and other developer resources<h2>

The text alternative in the example above could also include the word "logo" to describe the type of image content. If so, it is suggested that square brackets be used to delineate this information: alt="[logo] WebPlatform.org".

If a logo is being used next to the name of the entity it represents, then the logo is supplemental. Include an empty alt attribute as the text alternative is already provided.

This example illustrates the use of a logo next to the name of the organization it represents.

WebPlatform.org

<img src="images/webplatform1.png" alt=""> WebPlatform.org

If the logo is used alongside text discussing the subject or entity the logo represents, then provide a text alternative which describes the logo.

This example illustrates the use of a logo next to text discussing the subject the logo represents.

HTML5 logo: Shaped like a shield with the     text 'HTML' above and the numeral '5' prominent on the face of the shield.

HTML5 is a language for structuring and presenting content for the World Wide Web, a core technology of the Internet. It is the latest revision of the HTML standard (originally created in 1990 and most recently standardized as HTML4 in 1997) and currently remains under development. Its core aims have been to improve the language with support for the latest multimedia while keeping it easily readable by humans and consistently understood by computers and devices (web browsers, parsers etc.).

<p><img src="HTML5_Logo.png" 
alt="HTML5 logo: Shaped like a shield with the text 'HTML' above and the numeral '5' 
prominent on the face of the shield."></p>  

Information about HTML5

1.19 CAPTCHA Images

CAPTCHA stands for "Completely Automated Public Turing test to tell Computers and Humans Apart". CAPTCHA images are used for security purposes to confirm that content is being accessed by a person rather than a computer. This authentication is done through visual verification of an image. CAPTCHA typically presents an image with characters or words in it that the user is to re-type. The image is usually distorted and has some noise applied to it to make the characters difficult to read.

To improve the accessibility of CAPTCHA provide text alternatives that identify and describe the purpose of the image, and provide alternative forms of the CAPTCHA using output modes for different types of sensory perception. For instance provide an audio alternative along with the visual image. Place the audio option right next to the visual one. This helps but is still problematic for people without sound cards, the deaf-blind, and some people with limited hearing. Another method is to include a form that asks a question along with the visual image. This helps but can be problematic for people with cognitive impairments.

It is strongly recommended that alternatives to CAPTCHA be used, as all forms of CAPTCHA introduce unacceptable barriers to entry for users with disabilities. Further information is available in Inaccessibility of CAPTCHA.

This example shows a CAPTCHA test which uses a distorted image of text. The text alternative in the alt attribute provides instructions for a user in the case where she cannot access the image content.

captcha containing the words 'aides' and 'sprucest'. The letters are distorted and the color of the letters and background is partially inverted,

<img src="captcha.png" alt="If you cannot view this image an audio challenge is provided.">    
 <!-- audio CAPTCHA option that allows the user to listen and type the word -->     
 <!-- form that asks a question -->    

2. Methods for Providing Text Alternatives

2.1 Native HTML methods

The img element alt attribute

The primary method for providing text alternatives for images is by including text in the img element alt attribute. In graphical browsers the content of the alt attribute is typically displayed along with an indication (bordered area and/or an image icon) of the presence of an image when the image is not displayed, because the user has disabled image display or the image source information is incorrect. Assistive technologies such as screen readers will typically announce the presence of an image followed by the alt attribute content. Text based browsers may display the alt attribute content in brackets or in different colored text or as the content of a link to the image or as text without any indication of the image or prefixed with an indication of the image.

<img src="example.jpg" alt="text alternative.">

Advantages:

Disadvantages:

2.2 Is alt attribute content a replacement for an image?

The answer to this question depends on the content of the image and the context the image is being used in:

2.3 Using an empty alt attribute alt=""

Circumstances in which it is appropriate to use an empty or null alt attribute:

Circumstances in which it is not appropriate to use an empty or null alt attribute:

2.4 How long should a text alternative be?

A text alternative for an image should be as long as it needs to be to adequately convey the information in the image, in the context the image is being used.

How long should an alt text be?

While there are no definitive right or wrong lengths for text alternatives provided using the img element's alt attribute, the general consensus is that if the text alternative is longer 30-50 words (2 to 3 sentences), it should not be considered a short text alternative and should not be presented using the alt attribute. Refer to the section - Graphical Representations: Charts, diagrams, graphs, maps, illustrations for example methods of providing longer text alternatives for images.

Note

A text alternative provided using the alt attribute is exposed to screen reader users as a text string, generally announced as a chunk, and cannot be structured into paragraphs or have other markup added to aid comprehension.

2.5 The figure and figcaption elements

The figure and figcaption elements provide a method to explicitly associate a caption with a variety of content including images. Any content inside the figure element that is not contained within the figcaption element is labelled by the content of the figcaption element. The figcaption content may be an adjunct to the text alternative provided using the alt attribute:

The figcaption content may be a text alternative for the image, obviating the need for a text alternative provided using the alt attribute. This would only be the case if the figcaption content provides an adequate text alternative for the visual content in the image:

Shadow like figures and a graffiti tag drawn on the walls of a partially demolished building, illuminated by the light from a street lamp.

<img src="example.jpg" alt="Shadow like figures and a graffiti tag drawn on the walls of a partially   
demolished building, illuminated by the light from a street lamp.">
      

(photo)

Shadow like figures and a graffiti tag drawn on the walls of a
partially demolished building, illuminated by the light from a street lamp (photo).

<figure>   
<img src="shadows.jpg">
<figcaption> Shadow like figures and a graffiti tag drawn on the walls of a partially demolished building, illuminated by the light from a street lamp (photo). </figcaption>
</figure>

Advantages:

Disadvantages:

Until the figure and figcaption elements are widely accessibility supported by browsers and/or assistive technology it is recommended that role="group" be used on the figure element and in the case where the figcaption content is the text alternative, provide a label for the image in the alt attribute. These recommendations are illustrated in following example:

(photo 1)

Shadow like figures and a graffiti tag drawn on the walls of a
partially demolished building, illuminated by the light from a street lamp (photo 1).

<figure role="group">
      <img src="shadows.jpg" alt="photo 1"> 
      <figcaption>]Shadow like figures and a graffiti tag drawn on the walls of a        
     partially demolished building, illuminated by the light from a street lamp (photo 1).
     </figcaption>
     </figure>

Using nested figure elements

In cases where there is a group of related images each having an associated caption, it is recommended that nested figure and figcaption elements be used.

The castle through the ages: 1423, 1756, and 1966 respectively.

The castle has one tower, and a tall wall around it.

Charcoal on wood. Anonymous, circa 1423

.The castle now has two towers and two walls.

Oil-based paint on canvas. Eloisa Faulkner, 1756.

The castle lies in ruins, the original tower all that remains in one piece.

Film photograph. Séraphin-Médéric Mieusement, 1936.

<figure>  
<figcaption>The castle through the ages: 1423, 1756, and 1966 respectively.</figcaption>    
<figure> 
<img src="castle-etching.jpg" alt="The castle has one tower, and a tall wall around it.">  
<figcaption>Charcoal on  wood. Anonymous, circa 1423.</figcaption>  
</figure> 
<figure>   
<img src="castle-painting.jpg" alt="The castle now has two towers and two walls.">  
<figcaption>Oil-based paint on canvas. Eloisa Faulkner, 1756.</figcaption>  
</figure> 
<figure>  
<img src="castle-fluro.jpg" 
alt="The castle lies in ruins, the original tower all that remains in one piece.">  
<figcaption>Film photograph. <span lang="fr">Séraphin Médéric Mieusement</span>, 1936.</figcaption>  
</figure>
</figure>

2.6 The img element title attribute

The title attribute must not be used to provide a text alternative for an image. The title attribute must not be used to provide a caption for an image; use the figure and figcaption elements to provide a caption, as described above.

3. Notes on use of Gaiji

4. Glossary

Accessibility API

Operating systems and other platforms provide a set of interfaces that expose information about objects and events to assistive technologies. Assistive technologies use these interfaces to get information about and interact with those widgets. Examples of this are the Java Accessibility API [JAPI], Microsoft Active Accessibility [MSAA], the Mac OS X Accessibility Protocol [AXAPI], the Gnome Accessibility Toolkit (ATK) [ATK], and IAccessible2 [IA2].

Accessible name

The accessible name is the name of a user interface element. Each platform accessibility API provides the accessible name property. The value of the accessible name may be derived from a visible (e.g., the visible text on a button) or invisible (e.g., the text alternative that describes an icon) property of the user interface element.

alt text

Colloquial term for a text alternative provided using the alt attribute of an img element.

assistive technology

Hardware and/or software that acts as a user agent, or along with a mainstream user agent, to provide functionality to meet the requirements of users with disabilities that go beyond those offered by mainstream user agents. A more detailed explanation of assistive technology is provided in the WCAG 2.0 glossary.

content (Web content)

Information and sensory experience to be communicated to the user by means of a user agent such as a web browser, including code or markup that defines the content's structure, presentation, and interactions.

programmatic association

It must be possible for people using assistive technologies to find the text alternative for an image when they encounter the image that they cannot use. To accomplish this, the text must be "programmatically associated" with the image. This means that the user must be able to use their assistive technology to find the alternative text (that they can use) when they land on the image (that they can't use).

non-text content

Any content that is not a sequence of characters that can be programmatically determined or where the sequence is not expressing something in human language

Note: This includes ASCII Art (which is a pattern of characters), emoticons, leetspeak (which uses character substitution), and images representing text.

Empty alt attribute or null alt attribute.

An alt attribute with no content:

<img src="null.gif" alt="">

Text alternative

Text that is programmatically associated with non-text content or referred to from text that is programmatically associated with non-text content. Programmatically associated text is text whose location can be programmatically determined from the non-text content.

A. References

[ARIA]
James Craig; et al. Accessible Rich Internet Applications (WAI-ARIA) 1.1
[HTML5]
Robin Berjon; Steve Faulkner; Travis Leithead; Erika Doyle Navara; Edward O'Connor; Silvia Pfeiffer. HTML5. 17 June 2014. W3C Last Call Working Draft. URL: http://www.w3.org/TR/html5/
[WAI-ARIA]
James Craig; Michael Cooper et al. Accessible Rich Internet Applications (WAI-ARIA) 1.0. 20 March 2014. W3C Recommendation. URL: http://www.w3.org/TR/wai-aria/
[WCAG20]
Michael Cooper; et al. Web Content Accessibility Guidelines (WCAG) 2.0. 11 December 2008. W3C Recommendation.

B. Acknowledgements

Incomplete and in no particular order - Heydon Pickering, David MacDonald, Laura Carlson, Josh O Connor, Gez Lemon, Anne van Kesteren, Ian Hickson, Mike Smith, Mike Paciello, Bim Egan, Gregory Rosmaita, Michael Cooper, Janina Sajka, Matt May, Bevi Chagnon, Jonathan Avila, Pat Rees, Charlie Pike, Andy Maseyk, Rich Clark.