HTML <track>Tag
Example
A video with a subtitle track (friday.vtt):
<video width="320" height="240" controls>
<video controls
src="/video/php/friday.mp4">
<track default
kind="captions"
srclang="en"
src="/video/php/friday.vtt" />Sorry, your browser does not support embedded video!</video>
</video>
Try it Yourself »
Browser Support
The numbers in the table specify the first browser version that supports the tag.
| Element | |||||
|---|---|---|---|---|---|
| <track> | 23.0 | 10.0 | 31.0 | 6.0 | 12.1 |
Definition and Usage
The <track> tag specifies external text tracks for media elements (such as <audio> and <video>), namely subtitles. The subtitle formats are WebVTT format (.vtt format files).
This element is used to specify subtitle files or other files containing text, which are visible when the media is played.
Differences Between HTML 4.01 and HTML5
The <track> tag is a new tag in HTML5.
Optional Attributes
New: New attributes in HTML5.
| Attribute | Value | Description |
|---|---|---|
| defaultNew | default | Specifies that the track is the default. If the user has not selected any track, the default track is used. |
| kindNew | captions chapters descriptions metadata subtitles |
Specifies the text type of the text track. |
| labelNew | text | Specifies the label and title of the text track. |
| srcNew | URL | Required. Specifies the URL of the track file. |
| srclangNew | language_code | Specifies the language of the track text data. This attribute is required if the value of the kind attribute is "subtitles". |
Global Attributes
<track> tag supportsHTML Global Attributes。
Event Attributes
<track> tag supportsHTML Event Attributes。
Other Extensions