HTML <track> tag

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

When writing in HTML (hypertext markup language), the <track> tag designates text tracks for the <audio> and <video> tags. It is useful for adding 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, and 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

In 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 the current unique HTML attributes for the <track> tag, and 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 (uniform resource locator) of the text track; required attribute.
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