<track> Tag — HTML Technical Interview Questions & Answers

Subtitle/caption tracks for audio and video.

<track> Tag

  • Subtitle/caption tracks for audio and video.
  • <track> is the <track> HTML element. HTML uses this tag so the browser (and screen readers) know what the piece is, not only how it looks.
  • Board: <track>…</track> Put it in body. Check it in the browser. Attributes go on the opening tag.
  • Trap: wrong nesting or missing a required attribute. CSS can still style it — don’t pick a tag only because of default italics.
  • Interview: name the tag, one attribute if it has a famous one (href, src, alt, for, type), one mistake.

Technical Interview Tip: <track>: the <track> HTML element. Example: <track>…</track>

Code Examples for <track> Tag

<track> Tag — working example

<figure>
  <video controls width="480" poster="/media/poster.jpg">
    <source src="/media/intro.mp4" type="video/mp4" />
    <track kind="captions" src="/media/intro.vtt" srclang="en" label="English" />
    Download the <a href="/media/intro.mp4">MP4</a>.
  </video>
  <figcaption>Course intro with captions</figcaption>
</figure>

<audio controls>
  <source src="/media/tip.mp3" type="audio/mpeg" />
</audio>

<track> Tag — provide controls, multiple source types when needed, and captions/transcripts for accessibility.

How to Explain <track> Tag to an Interviewer

What is the <track> tag?

the <track> HTML element <track>…</track>

One common mistake?

wrong nesting or missing a required attribute