Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

The `<track>` Element – Subtitles and C | HTML Course lesson | BraveProgrammer
  1. Courses
  2. /
  3. HTML Course

Lesson 47 of 55

·HTML

The `<track>` Element – Subtitles and Captions

9 min

Course progress85%

What you'll learn

Keep these ideas in mind as you work through the lesson.

5 points
  • Adding subtitles, captions, descriptions, and chapters with `<track>`
  • Supported `kind` values and their intended use
  • Basic VTT file format for timed text
  • Accessibility compliance – always provide `captions`
  • Testing captions with screen readers and video players

The <track> Element – Subtitles, Captions, and Chapters

<track> adds timed‑text tracks to <video> and <audio> elements.

<video controls width='640'>
  <source src='movie.mp4' type='video/mp4' />
  <track kind='captions' src='captions.vtt' srclang='en' label='English' default />
  <track kind='subtitles' src='captions.es.vtt' srclang='es' label='Español' />
  Your browser does not support the video tag.
</video>

kind attribute values

  • captions – For the hearing‑impaired; displays by default.
  • subtitles – Translations of spoken dialogue for multilingual audiences.
  • descriptions – Audio descriptions for visually impaired users.
  • chapters – Table of contents with timestamps.
  • metadata – Timed metadata (e.g., song title, author).

VTT file format (sample)

WEBVTT

00:00:00.000 --> 00:00:05.000
Welcome to the tutorial.

00:00:05.000 --> 00:00:10.000
Here we learn about HTML.

Accessibility compliance

  • Provide captions (kind='captions') for any video that conveys essential information – this satisfies WCAG AA.
  • Use srclang to indicate the language of each track.
  • Ensure the default track is appropriate for the primary audience.

Quick checklist for <track>

  1. kind='captions' present for essential video content? ✅
  2. VTT files correctly formatted and linked? ✅
  3. srclang attribute matches the language of the track? ✅
  4. Default track (default) set for the primary language? ✅
  5. Tested with screen readers to confirm captions are accessible? ✅

Tip: For long‑form video, also add a chapters track so users can jump to sections easily.

Make it stickPractice what you've learned1 quiz · 2 practical tests · Optional activities from HTML CourseBrowse activities
Previous lessonUsing `<meter>` and `<progress>` for UI ElementsContinue to lesson 48The `<time>` Element – Machine‑readable Dates & TimesBack to HTML Course curriculum