HTML <track> tag

Updated: 11/13/2018 by Computer Hope
HTML track tag

When writing in HTML, the <track> tag is used to designate text tracks for both the <audio> and <video> tags. It is useful for when you want to add captions, subtitles, or other forms of text that display as the media plays. The following sections contain information about this tag, including an example of its code, as well as related attributes and browser compatibility.

Example of <track> code

<video controls="controls">
Your browser does not support the &lt;video&gt; tag. <source src="../m/computer-hope.mp4" /> <source src="../m/computer-hope.ogg" /> <track src="english-subtitles.vtt" kind="subtitles" srclang="en" label="English">
<track src="spanish-subtitles.vtt" kind="subtitles" srclang="sp" label="Spanish">
</video>

Attributes

Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up of a name and value pair; all tags support standard attributes. The following table shows all of the current unique HTML attributes for the <track> tag, as well as a description of each.

Attribute Description
default Designates that the track should be enabled unless the user's preferences suggest another.
kind Designates the kind of text track in use.
label Designates a label for the text track.
src Designates the URL of the text track (required).
srclang Designates the language of the text track.

Compatibility

Edge Internet Explorer Firefox Safari Opera Chrome
All versions 10.0+ 31.0+ 6.0+ 12.1+ 23.0+

Browser, Caption, Code, Compatibility, Embed, Loop, Mute, Video, Web design terms, Web page