Good accessibility usually starts with clear words and the right HTML elements, not a large amount of extra code.
What You Need to Know
Captions make spoken words and important sounds available as text alongside video. A transcript works separately from playback; audio descriptions explain visual information that dialogue does not convey. Choose the format the content needs.
In this example: pair a video with a subtitle track.
Try the Example
Take a look at the example. We’ll explain the important lines right below it.
<video controls width="480">
<source src="media/lesson.mp4" type="video/mp4">
<track src="media/captions-en.vtt" kind="captions" srclang="en" label="English" default>
Your browser cannot play this video.
</video>
Let’s Read the Code
- <video>: The video element creates a video player and can include alternative formats.
- <source>: A source points to a media file or image choice with a type or other condition.
- controls: Controls asks the browser to provide its native audio or video player controls.
- width: Width gives a preferred or intrinsic media width, depending on the element.
Read the named elements and attributes together. They explain how the browser connects this feature to the rest of the page.
What Happens in the Browser?
Try this with Tab and Shift+Tab. If you can, inspect the accessibility tree too; appearance alone does not tell the whole story.
Try a different way of reading. Read only the headings and labels, or navigate through links without looking at the rest of the page. If the page still makes sense, the underlying HTML is probably doing an important part of its job.
Your Turn
Use Tab and Shift+Tab to visit the controls, then read their labels aloud. Is the purpose of each one clear?
Common Beginner Mistakes
- Expecting the page to run scripted behavior when the required JavaScript is missing.
- ARIA changes what assistive technology is told; it does not automatically add keyboard controls, visual styling, or JavaScript behavior.
Key Takeaways
- Captions make spoken words and important sounds available as text alongside video.
- <video>: The video element creates a video player and can include alternative formats.
- A meaningful HTML element is usually a stronger starting point than adding an ARIA role to a generic div. Also check what happens using only the keyboard.