Making video accessible to everyone with text tracks
This video includes English captions using WebVTT format.
<video controls>
<source src="video.mp4" type="video/mp4">
<track
kind="captions"
src="captions-en.vtt"
srclang="en"
label="English"
default
>
<track
kind="subtitles"
src="subtitles-es.vtt"
srclang="es"
label="Español"
>
</video>
The kind attribute specifies the purpose of each text track.
WebVTT (Web Video Text Tracks) is the standard caption format for HTML5 video.
Modern browsers support the ::cue pseudo-element for caption styling.
video::cue {
background: rgba(0, 0, 0, 0.85);
color: #fff;
font-family: 'Inter', sans-serif;
font-size: 1.1em;
line-height: 1.4;
}
video::cue(b) {
color: #fbbf24; /* Highlight bold text */
}
video::cue(i) {
color: #a5b4fc; /* Style italic text */
}