HTML Tags

HTML5 <track> Tag

Topic: HTML5 Tags ReferencePrev|Next

Description

The <track> element is used to specify supplementary text tracks such as subtitle tracks and caption tracks for <audio> and <video> elements.

The following table summarizes the usages context and the version history of this tag.

Permitted Parent: A media element, like <audio> or <video>
Content: None. It is an empty element.
Start/End Tag: Start tag: required, End tag: forbidden
Version: New in HTML5

Syntax

The basic syntax of the <track> tag is given with:

HTML: <track>; XHTML: <track />

The example below shows the <track> tag in action.

<video controls="controls">
    <source src="shuttle.mp4" type="video/mp4">
    <source src="shuttle.ogv" type="video/ogg">
    <track src="subtitles_en.vtt" kind="subtitles" srclang="en" label="English">
    Your browser does not support the HTML5 Video element.
</video>

Tag-Specific Attributes

The following table shows the attributes that are specific to the <track> tag.

Attribute Value Description
Required — The following attribute must be specified on this tag for the markup to be valid.
src URL Specifies the URL of the track file.
Optional — The following attributes are optional.
default default Specifies that the track should be enabled unless the user's preferences indicate that another track is more appropriate.
kind captions
chapters
descriptions
metadata
subtitles
Specifies the kind of text track.
label text Specifies the title of the text track.
srclang language-code Specifies the language of the track text data. The srclang must be defined, if the kind attribute is set to subtitles.

Global Attributes

Like all other HTML tags, the <track> tag supports the global attributes in HTML5.


Event Attributes

The <track> tag also supports the event attributes in HTML5.


Browser Compatibility

The <track> tag is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 31+
  • Google Chrome 18+
  • Internet Explorer 10+
  • Apple Safari 6+
  • Opera 15+

Further Reading

See tutorial on: HTML5 Audio, HTML5 Video.

Related tags: <audio>, <video>, <source>.

Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties