HTML CSS examples for HTML Tag:track
The <track> element sets supplementary text tracks such as subtitle tracks and caption tracks for <audio> and <video> elements.
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 |
<!DOCTYPE html> <html lang="en"> <head> <title>Example of HTML track Tag</title> </head><!-- ww w . j a v a 2s .c o m--> <body> <video controls="controls"> <source src="your.mp4" type="video/mp4"> <source src="your.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> </body> </html>
The following table shows the attributes that are specific to the <track> tag.
Attribute | Require | Value | Description |
---|---|---|---|
src | Required | URL | URL of the track file. |
default | Optional | default | track should be enabled unless the user's preferences indicate that another track is more appropriate. |
kind | Optional | captions chapters descriptions metadata subtitles | sets the kind of text track. |
label | Optional | text | sets the title of the text track. |
srclang | Optional | language-code | sets the language of the track text data. The srclang must be defined, if the kind attribute is set to subtitles. |