Web Fundamentals · Lesson 5 of 10 · 3 min
Multimedia & Embedded Content Accessibility
Interviewers ask about this to see if you think beyond the happy path and consider users who can't see or hear your content.
After this, you will be able to explain exactly how to make images, videos, and iframes accessible. This isn't just about compliance; it's about demonstrating a senior-level attention to detail and user experience.
How to write alt text for images
The alt attribute is the single most important accessibility feature for an <img>. It serves users who can't see the image. Your job is to decide if the image is decorative or informative.
Informative images convey content. The alt text should be a concise description of that content.
alt="A bar chart showing a 25% increase in Q3 sales."
Decorative images are purely for visual styling, like background patterns or ornamental dividers. Use an empty alt attribute (alt="") to tell screen readers to ignore them completely.
The trap: Never omit the
altattribute. If you do, some screen readers will announce the image's filename, which is a terrible user experience. An emptyaltis a deliberate choice; a missingaltis a mistake. Also, avoid redundant phrases like "Image of..." or "Picture of...". The screen reader already knows it's an image.
For complex images like charts or diagrams that need more explanation than alt text can provide, use <figure> and <figcaption>. The figcaption is visible to all users and programmatically associated with the figure.
<figure>
<img src="sales-chart-q3.png"
alt="Bar chart showing quarterly sales. Details in the caption.">
<figcaption>
Figure 1: Quarterly sales growth. Q1: $1.2M, Q2: $1.4M, Q3: $1.75M.
The 25% growth in Q3 was driven by the new product launch.
</figcaption>
</figure>
This decision process is a common source of confusion. Use this flow to get it right every time.
How to make video and audio usable for everyone
Time-based media creates barriers for users with hearing or vision impairments. You need to provide alternatives. The <track> element is your main tool here.
- Captions are for users who are deaf or hard of hearing. They include dialogue and important non-speech audio, like
[door slams]or[dramatic music]. Usekind="captions". - Subtitles are for users who can hear but don't understand the language. They only include dialogue. Use
kind="subtitles". - Audio Descriptions are for users who are blind or have low vision. This is a separate audio track that narrates important visual information that isn't conveyed through the main audio. Use
kind="descriptions". - Transcripts are a full text version of the media. They benefit everyone, including search engines. Provide them as plain text on the page.
Here is how you structure a <video> element to include these.
<video controls preload="metadata">
<source src="my-awesome-video.mp4" type="video/mp4">
<!-- For users who are deaf or hard of hearing -->
<track
kind="captions"
label="English Captions"
src="captions-en.vtt"
srclang="en"
default>
<!-- For users who are blind or have low vision -->
<track
kind="descriptions"
label="English Audio Descriptions"
src="descriptions-en.vtt"
srclang="en">
<!-- For translation -->
<track
kind="subtitles"
label="Español"
src="subtitles-es.vtt"
srclang="es">
<!-- Fallback for old browsers -->
<p>Your browser does not support the video element.</p>
</video>
Answering in an interview: When asked how to make a video accessible, a complete answer addresses both hearing and vision impairments. Mention captions for the deaf, and audio descriptions for the blind. That shows you're thinking comprehensively.
Finally, never use the autoplay attribute unless the user has explicitly consented. Unexpected audio is disruptive and can interfere with screen reader output.
What interviewers want to hear about <iframe>
When you embed content from another site, like a YouTube video or a Google Map, you use an <iframe>.
The single most important accessibility requirement for an <iframe> is the title attribute.
A screen reader user navigating a page will encounter the frame and hear its title. Without a title, they just hear "frame" and have no idea what it contains or why it's there. The title provides that crucial context.
Bad:
<iframe src="..."></iframe>
Good:
<iframe src="..." title="Google Map showing the route to our office"></iframe>
The title should be descriptive and make sense out of context. "Video" is not a good title. "Product demo video for the new X-Processor" is a good title.
You are not in control of the accessibility of the content inside a third-party iframe. Your responsibility is to label the frame itself correctly so users can decide whether to interact with it.
Lock it in — apply this lesson under interview conditions.