HTML <track> Tag
Description
The <track>
HTML element is used to specify external timed text tracks for media elements (i.e. the <video>
element and the <audio>
element). The text tracks specified with the <track>
tag could include subtitles, captions, descriptions, chapters, and metadata.
Properties
- Permitted Parents
- A media element, before any flow content
- Content
- None. It is an empty element.
- Start/End Tags
- Start tag: required, End tag: forbidden
Example
<video width="300" height="240" controls>
<source src="audio/toy.mp4" type="video/mp4">
<track src="subtitles_en.vtt" kind="subtitles" srclang="en" label="English">
<track src="subtitles_it.vtt" kind="subtitles" srclang="it" label="Italian">
Your browser does not support the video tag.
</video>
Attributes
Attribute | Definition |
---|---|
default | Specifies that the track is to be enabled if the user's preferences do not indicate that another track would be more appropriate |
kind | How the text track is meant to be used. If omitted the default kind is subtitles. If the attribute is not present, it will use the subtitles.
Possible Values:
|
label | Specifies the kind of text track |
src | Required. Specifies the URL of the track file |
srclang | Specifies the language of the track text data (required if kind="subtitles") |
Global Attributes
The <track>
tag also supports the Global Attributes in HTML5
Event Attributes
The <track>
tag also supports the Event Attributes in HTML5
Browser Support
The following table will show you the current browser support for the HTML <track>
tag.
Desktop | |||||
12 | 12 | 31 | 12.1 | 6 |
Tablets / Mobile | |||||
25 | 31 | 12.1 | 6 | 1.5 | 4.4 |
Last updated by CSSPortal on: 30th March 2024