html tutorial - Track <track> tag in HTML - html5 - html code - html form



track tag in html

Learn html - html tutorial - track tag in html - html examples - html programs

  • <track> tag is used for defining subtitles, captions and other content for audio and video tags.
  • <track> tag is particularly specifying text track for media tags.
  • It supports Global and event attributes.

Syntax for <track> tag:

<track src=”source file”>

Differences between HTML 4.01 and HTML5 for <track> tag

HTML 4.01

  • HTML4 does not supports <track> tag.

HTML5

  • The track tag is new to HTML5.

Sample Coding for <track> tag:

Tryit<!DOCTYPE html>
<html >
    <head>
        <title>Wikitechy track tag</title>
    </head>
    <body>
        <h2>HTML track tag with example</h2>
        <form>
            <video width="320" height="240" controls>
            <source src="hibiscus.mp4" type="video/mp4">
            <track src="subtitles.vtt" kind="subtitles" srclang="en" 
                   label="english">
        </video>
    </body>
</html>

Code Explanation for <track> tag:

code explanation for track tag

  1. <video> tag will display the movie clips or any other video file.
  2. <source> tag is given for the file path of the video file.
  3. <track> tag is defined the subtitles for the video file.
  4. “src” attribute used to define the location of the track file.
  5. “kind” attribute is used to specifies the file as “subtitles”.
  6. The “srclang” attribute specifies the language of the track text data as “en”.
  7. The “label” attribute used to specify the title of the track file as “english”.

Browser Support for <track> tag:

18.0 10.0 31.0 6.0 15.0

Related Searches to track tag in html