Example: Alt text patterns for different scenarios
<!-- Informative image --><img src="chart.png" alt="Quarterly sales increased 35% from Q1 to Q2"><!-- Decorative image (empty alt) --><img src="divider.png" alt=""><img src="pattern.png" role="presentation"><!-- Functional image (button/link) --><button> <img src="trash.png" alt="Delete item"></button><a href="/"> <img src="logo.png" alt="Return to homepage"></a><!-- Logo in header --><header> <a href="/"> <img src="logo.svg" alt="Acme Corp"> </a></header><!-- Image with caption (don't duplicate) --><figure> <img src="sunset.jpg" alt="Golden sunset over mountain range"> <figcaption> Sunset at Rocky Mountain National Park, June 2024 </figcaption></figure><!-- Complex image with long description --><img src="org-chart.png" alt="Company organizational chart" aria-describedby="chart-desc"><div id="chart-desc"> <p>Hierarchical structure showing CEO at top, reporting to three Vice Presidents for Engineering, Sales, and Marketing...</p></div><!-- Image map --><img src="map.png" alt="United States map" usemap="#us-map"><map name="us-map"> <area shape="poly" coords="..." href="/ca" alt="California"> <area shape="poly" coords="..." href="/tx" alt="Texas"></map><!-- Background image with CSS (provide text alternative) --><div class="hero" style="background-image: url('hero.jpg')" role="img" aria-label="Team collaborating in modern office"></div>
Alt Text Guidelines
Do
Don't
Length
Concise (typically <150 chars)
Write lengthy paragraphs in alt
Phrases to Avoid
Start directly with content
"Image of...", "Picture of...", "Graphic of..."
Punctuation
Use proper punctuation
Omit periods or use all caps
Context
Match surrounding content context
Provide irrelevant details
File Names
Write meaningful description
Use file names: "IMG_1234.jpg"
Redundancy
Complement adjacent text
Duplicate nearby text verbatim
Decorative
Use alt=""
Omit alt attribute entirely
Warning: Missing alt attributes cause screen readers to announce the file name. Always include
alt="" for decorative images rather than omitting the attribute.
2. Video Captions and Transcripts
Caption Type
Format
Use Case
WCAG Level
Closed Captions (CC)
WebVTT (.vtt), SRT (.srt)
User can toggle on/off - includes dialogue + sounds
AA (prerecorded)
Open Captions
Burned into video
Always visible, cannot be disabled
AA (prerecorded)
Subtitles
WebVTT (.vtt)
Translation for different languages
Not required
Full Transcript
HTML text
Complete text of all audio + visual descriptions
AAA (recommended)
Live Captions
Real-time text stream
Live broadcasts, meetings
AA (live content)
Example: Video with captions and transcript
<!-- Video with multiple caption tracks --><video controls width="640" height="360"> <source src="video.mp4" type="video/mp4"> <source src="video.webm" type="video/webm"> <!-- English captions (default) --> <track kind="captions" src="captions-en.vtt" srclang="en" label="English" default> <!-- Spanish subtitles --> <track kind="subtitles" src="subtitles-es.vtt" srclang="es" label="Español"> <!-- Audio description track --> <track kind="descriptions" src="descriptions.vtt" srclang="en" label="Audio Descriptions"> <!-- Fallback for browsers without video support --> <p>Your browser doesn't support HTML5 video. <a href="video.mp4">Download the video</a> or <a href="#transcript">read the transcript</a>. </p></video><!-- Transcript section --><details id="transcript"> <summary>Video Transcript</summary> <div> <h3>Introduction to Web Accessibility</h3> <p><strong>[00:00]</strong></p> <p><strong>Narrator:</strong> Welcome to our guide on web accessibility.</p> <p><strong>[00:05] [Background music plays]</strong></p> <p><strong>Narrator:</strong> In this video, we'll explore why accessibility matters.</p> <p><strong>[00:10] [Visual: Statistics chart appears]</strong></p> <p><strong>Narrator:</strong> Over 1 billion people worldwide have disabilities.</p> <p><strong>[End of transcript]</strong></p> </div></details>
Example: WebVTT caption file format
WEBVTTNOTE This is a caption file for accessibility demo00:00:00.000 --> 00:00:03.000Welcome to our guide on web accessibility.00:00:03.500 --> 00:00:07.000[Background music plays]00:00:07.000 --> 00:00:11.000In this video, we'll explore why accessibility matters.00:00:11.500 --> 00:00:15.000<v Narrator>Over 1 billion people worldwide have disabilities.</v>00:00:15.500 --> 00:00:19.000[Upbeat music]Making websites accessible benefits everyone.NOTE You can add speaker names with <v Speaker Name>NOTE You can add positioning with align:start, align:middle, align:end
Caption Content Requirements
Include
Example
Dialogue
All spoken words
"Welcome to our presentation"
Speaker Identification
Who is speaking (when not obvious)
"<v Sarah>Let me explain...</v>"
Sound Effects
Important non-speech sounds
"[Door slams]", "[Phone rings]"
Music Cues
Mood-setting or significant music
"[Suspenseful music]", "[♪ Jazz playing ♪]"
Tone/Manner
How something is said (when important)
"[Sarcastically] That's just great."
Off-Screen Audio
Sounds from outside frame
"[Voice from hallway] Is anyone there?"
Note: Captions and subtitles are different. Captions include
dialogue + sound effects for deaf/hard-of-hearing. Subtitles are translations of
dialogue only.
WEBVTTNOTE Audio descriptions for presentation video00:00:05.000 --> 00:00:08.000A woman in a blue suit stands at a podium.00:00:15.000 --> 00:00:18.000She gestures to a graph showing upward trending data.00:00:28.000 --> 00:00:32.000The camera pans to audience members taking notes.00:00:45.000 --> 00:00:49.000A pie chart appears on screen showing market distribution.00:01:02.000 --> 00:01:06.000The speaker smiles and nods to acknowledge applause.
What to Describe
Priority
Example Description
Actions
High
"Sarah picks up the phone"
Settings/Scenes
High
"Modern office with glass walls"
Characters/People
High
"A man in his 40s with gray hair"
On-Screen Text
High
"Title card: Five Years Later"
Facial Expressions
Medium
"She frowns and looks away"
Clothing/Appearance
Medium
"Wearing a red dress and pearl necklace"
Atmosphere/Mood
Low
"The dimly lit room creates tension"
Warning: Audio descriptions must fit between dialogue/narration without overlapping. If there
isn't enough time, consider extended audio descriptions (which pause video) or detailed transcripts.
Media Accessibility Checklist
Video
Audio Only
Captions/Subtitles
✓ Required (AA)
N/A
Audio Descriptions
✓ Required (AA)
N/A
Transcript
Recommended (AAA)
✓ Required (AA)
Keyboard Controls
✓ Required
✓ Required
Pause/Stop
✓ Required
✓ Required
Volume Control
✓ Required
✓ Required
No Auto-play
✓ Best practice
✓ Best practice
4. Complex Images and Data Visualization
Visualization Type
Accessibility Strategy
Implementation
Charts/Graphs
Short alt + detailed description + data table
aria-describedby + <table>
Infographics
Structured HTML alternative
Headings, lists, and semantic markup
Diagrams
Long description or labeled version
<details> or separate page
Maps
Interactive alternative or text description
List of locations with links/coordinates
Flowcharts
Text-based outline of flow
Ordered/nested lists showing steps
Interactive Dashboards
Keyboard navigation + ARIA live regions
Announce data updates, allow filtering
Example: Chart with multiple accessibility layers
<!-- Complex chart with comprehensive accessibility --><figure> <img src="sales-chart.png" alt="Bar chart: Monthly sales for 2024" aria-describedby="chart-summary chart-data"> <figcaption id="chart-summary"> Sales increased steadily throughout 2024, starting at $50K in January and reaching $120K by December, with notable spikes in June ($95K) and November ($115K). </figcaption> <!-- Detailed data table (can be in details/summary) --> <details> <summary>View detailed data table</summary> <table id="chart-data"> <caption>Monthly Sales Data 2024</caption> <thead> <tr> <th scope="col">Month</th> <th scope="col">Sales</th> <th scope="col">Change</th> </tr> </thead> <tbody> <tr> <th scope="row">January</th> <td>$50,000</td> <td>-</td> </tr> <tr> <th scope="row">February</th> <td>$58,000</td> <td>+16%</td> </tr> <tr> <th scope="row">March</th> <td>$65,000</td> <td>+12%</td> </tr> <!-- More rows... --> </tbody> </table> </details></figure>
Note: For complex interactive visualizations (D3.js, Chart.js), consider using accessible
charting libraries like Highcharts (with accessibility module) or provide comprehensive data tables as
alternatives.
5. Icon and SVG Accessibility
Icon Type
Treatment
Code Pattern
Screen Reader Output
Decorative Icon
Hide from AT
aria-hidden="true"
Ignored
Informative Icon
Provide text alternative
role="img" + aria-label
Announces label
Icon in Button
Label button, hide icon
aria-label on button, aria-hidden on icon
Announces button label
Icon with Adjacent Text
Hide icon from AT
aria-hidden="true" on icon
Announces text only
Icon Font
Add text or ARIA label
<span aria-label="Save"><i>💾</i></span>
Announces label
SVG Icon
Use <title> or aria-label
<svg><title>Save</title></svg>
Announces title
Example: Icon accessibility patterns
<!-- Decorative icon with text --><button> <svg aria-hidden="true" class="icon">...</svg> Save Document</button><!-- Icon-only button (needs label) --><button aria-label="Delete item"> <svg aria-hidden="true"> <use href="#trash-icon"></use> </svg></button><!-- Informative icon (standalone) --><svg role="img" aria-label="Warning"> <use href="#warning-icon"></use></svg><!-- SVG with title and desc --><svg role="img" aria-labelledby="save-title save-desc"> <title id="save-title">Save</title> <desc id="save-desc">Floppy disk icon</desc> <path d="M..."></path></svg><!-- Font icon (FontAwesome, Material Icons) --><span class="icon-wrapper"> <i class="fas fa-home" aria-hidden="true"></i> <span class="sr-only">Home</span></span><!-- Emoji icons (problematic - provide text alternative) --><span role="img" aria-label="thumbs up">👍</span><!-- Status icon with text --><span class="status"> <svg aria-hidden="true" class="icon-success">...</svg> <span>Successfully saved</span></span><!-- Icon link --><a href="/settings" aria-label="Settings"> <svg aria-hidden="true"> <use href="#gear-icon"></use> </svg></a><!-- Icon sprite definition (hidden) --><svg style="display: none;"> <symbol id="trash-icon" viewBox="0 0 24 24"> <path d="M..."></path> </symbol> <symbol id="warning-icon" viewBox="0 0 24 24"> <path d="M..."></path> </symbol></svg>
SVG Accessibility Technique
Code
Use Case
<title> element
<svg><title>Icon name</title>...</svg>
Simple SVG with name only
<title> + <desc>
<title>...</title><desc>...</desc>
SVG needing detailed description
role="img"
<svg role="img">
Ensure SVG treated as image
aria-labelledby
aria-labelledby="title-id desc-id"
Link to title and desc elements
aria-label
<svg aria-label="Icon name">
Alternative to title element
aria-hidden="true"
<svg aria-hidden="true">
Decorative SVG
focusable="false"
<svg focusable="false">
Prevent focus in IE/Edge
Warning: Never use CSS content property for informative icons - screen readers may not announce
them. Always use proper HTML with ARIA labels or semantic <title> elements.
Note: Use native <video controls> when possible - browsers provide
accessible controls by default. Only build custom controls when design absolutely requires it.
Media and Content Accessibility Quick Reference
All images need alt attribute - use alt="" for decorative images
Describe content/function in alt text, not just "image of..." - keep under 150 characters
Videos require captions (AA) and audio descriptions (AA) for WCAG compliance
Provide transcripts for all media - helps SEO and provides searchable alternative
Use WebVTT format for captions: include dialogue, speaker ID, and sound effects
Complex charts need: short alt + detailed description + data table alternative
SVG icons: use aria-hidden="true" for decorative, role="img" +
aria-label for informative
Icon-only buttons must have aria-label - hide icon with aria-hidden
Custom video players need keyboard shortcuts (Space, arrows, M, F, C) and ARIA labels
Never auto-play media with sound - provide pause/stop controls within 3 clicks/taps