HTML <track> tag

Definition and Usage

<track> Tag <audio> or <video> This element specifies the text track.

This element is used to specify subtitles, subtitle files, or other text-containing files that should be visible when the media is played.

The track uses the WebVTT format (.vtt file).

See also:

HTML Tutorial:HTML Video

HTML Tutorial:HTML Audio

HTML DOM Reference Manual:Track Object

Example

A video with two language subtitle tracks:

<video width="320" height="240" controls>
  <source src="forrest_gump.mp4" type="video/mp4">
  <source src="forrest_gump.ogg" type="video/ogg">
  <track src="fgsubtitles_en.vtt" kind="subtitles" srclang="en" label="English">
  <track src="fgsubtitles_no.vtt" kind="subtitles" srclang="no" label="Norwegian">
</video>

Optional attribute

Attribute Value Description
Default Default Enable this track if the user's preferences do not indicate that another track is more suitable.
Kind
  • Captions
  • Chapters
  • Descriptions
  • Metadata
  • Subtitles
Specify the type of text track.
Label Text Specifies the title of the text track.
src URL Required. Specifies the URL of the track file.
srclang Language Code Specifies the language of the track text data (required if kind="subtitles").

Global Attributes

<track> The tag also supports Global Attributes in HTML.

Event Attributes

<track> The tag also supports Event Attributes in HTML.

Default CSS Settings

None.

Browser Support

The numbers in the table indicate the first browser version that fully supports this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
23.0 10.0 31.0 6.0 12.1