Loading...
HTML <track> Tag

HTML <track> Tag

In this tutorial, we will learn about track tag in HTML with the help of examples.


<track> Tag

Track tag <track> is used to specify text tracks for <audio> or <video> elements.
It specifies subtitles or caption files and the text is visible when the media is playing.

Syntax

<track />

Example

<!DOCTYPE html>
<html>
  <head>
    <title>track tag</title>
  </head>
  <body>
    <audio controls>
      <source src = "../audio/audio.mp3">
      <track src = "audio-subtitle.vtt" kind = "subtitles" srclang = "no">
    </audio>
  </body>
</html>

Output


Specific Attribute

Attribute Value Description
default default It specifies to use the default track
kind captions
chapters
descriptions
metadata
subtitles
It is used to define the kind of track is used
label text It is used to display title of text track
src URL It is used to specify the source/URL of the track file
srclang language code It is used to specify the language of the text

Global Attribute

Track Tag support all the global attributes of HTML.


Event Attribute

Track Tag support all the event attributes of HTML.


Next Tutorial

We hope that this tutorial helped you develop better understanding of the concept of <track> tag in HTML.

Keep Learning : )

In the next tutorial, you'll learn about HTML <u> Tag.

- Related Topics