Provide Alternative Description for Images

Provide meaningful Alt text for images. This helps users who rely on assistive technology such as a screen reader to understand the meaning of the image. The screen reader will read out the ALT description to the user.  

  • Example:  <img src="../images/womens_history_month_hero_image.png" alt="View the 2019 Women's History Month Opening Ceremony">

Images that Have Meaning

  • Examples of descriptive/meaningful Alt text

    • <img src="../images/dem_hero_image.png" alt="About the Neighborhood Emergency Response Team">

    • <img src="../images/city_seal.png" alt="City and County of San Francisco">

  • Examples of non-descriptive Alt text:

    • <img src="../images/city_seal.png" alt="image of city logo">

    • <img src="../images/dem_hero_image.png" alt="em_hero_image.png">

Decorative Images

Decorative images that don’t present important content or text should have null/empty alt text. Or in the event that ALT text is redundant. Screen readers will ignore these images all together. 

SVG Images

Provide screen reader users with alternative text for Scalable Vector Graphics (SVGs).

Example - Basic Non-Inline SVG Images:

<img class="lightbulb" role="img" src="https://upload.wikimedia.org/wikipedia/commons/2/2b/BulbIcon.svg" alt="Lightbulb moment!" />

 

Example - Inline SVG Images:

<svg role="img" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 48 48" style="enable-background:new 0 0 48 48;" xml:space="preserve"> <title>Lightbulb moment!</title> <path d="M19,39v-1h-0.5c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5H19v-2h10v2h0.5c0.3,0,0.5,0.2,0.5,0.5S29.8,38,29.5,38H29v1h0.5 c0.3,0,0.5,0.2,0.5,0.5S29.8,40,29.5,40H29c0,0-1.4,3-5,3s-5-3-5-3h-0.5c-0.3,0-0.5-0.2-0.5-0.5s0.2-0.5,0.5-0.5H19z M20,39h8v-1h-8 V39z M20.2,40c0.2,0.3,0.4,0.5,0.7,0.8c0.8,0.8,1.9,1.2,3.2,1.2s2.3-0.5,3.2-1.2c0.3-0.2,0.5-0.5,0.7-0.8H20.2L20.2,40z M20,37h8v-1 h-8V37z M16.1,7.8c-0.1-0.2,0-0.5,0.2-0.7c0.2-0.1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3c0-4.5-4.1-8.4-9-8.4s-9,3.9-9,8.4c0,2.7,0.6,4.2,2.2,6.3l0.4,0.6 c1.3,1.7,1.9,3,2.1,4.7C19.8,33,28.2,33,28.2,33z M21.4,15.9c0.3-0.1,0.5,0.1,0.6,0.3c0.1,0.2,0,0.5-0.3,0.6c-1.8,0.7-3.2,2.2-3.9,4 c-0.1,0.3-0.4,0.4-0.6,0.3c-0.2-0.1-0.4-0.4-0.3-0.6C17.6,18.4,19.3,16.7,21.4,15.9z"/> </svg>

General Guidelines

  • Here are some general guidelines to follow when providing Alt text. Alt text should:

    • Be succinct. Typically no more than a few words or a short sentence.

    • NOT be redundant or provide the same information as text within the context of the image.

    • NOT use the phrases "image of ..." or "graphic of ..." to describe the image. A screen reader already tells the user this information.

  • For complex diagrams, charts, maps and graphs a text based equivalent needs to be provided either within the context of the page, such as in an adjacent data table. The alternative text can also be provided by linking to a separate web page that provides the longer description of the complex image. 

Additional Information on Writing Effective Alt Text
https://webaim.org/techniques/alttext/