HTML kind Attribute

The HTML kind attribute specifies how a text track associated with an audio or video element is intended to be used, such as for subtitles, captions, descriptions, chapters, or metadata.

Elements That Use the kind Attribute

The kind attribute is used with the <track> element to identify the purpose of a timed text track associated with audio or video content.

Element Description
<track> Specifies the purpose of the text track, such as subtitles, captions, descriptions, chapters, or metadata.

kind Values

The kind attribute is an enumerated attribute that accepts five keywords.

Value Description
subtitles Provides a transcription or translation of dialogue for viewers who can hear the audio but may not understand the language.
captions Provides dialogue and other important audio information, such as sound effects, music cues, and speaker identification.
descriptions Provides text descriptions of the visual content for users who cannot see the video.
chapters Provides chapter titles that can be used to navigate sections of the media.
metadata Provides time-based data intended for use by scripts rather than direct presentation to the user.

Subtitles and Captions

Subtitles and captions serve different purposes. Subtitles are generally intended for viewers who can hear the audio but need a transcription or translation of the dialogue. Captions are intended for situations where the audio cannot be heard or understood and can include dialogue, sound effects, music cues, and other important audio information.

<video controls>
  <source src="video.mp4" type="video/mp4">
  <track src="captions.vtt" kind="captions" srclang="en" label="English" default>
</video>

The text track is normally stored in a WebVTT file with a .vtt filename extension.

Default Value

If the kind attribute is omitted, the text track defaults to subtitles.

<track src="subtitles.vtt" srclang="en" label="English">

If kind contains an invalid value, the attribute is treated as metadata. Using one of the defined keywords makes the intended purpose of the track clear.

The kind attribute is commonly used with other attributes on the <track> element.

Attribute Description
src Specifies the URL of the text track file.
srclang Specifies the language of the text track data and is required when kind="subtitles".
label Provides a user-readable title for the text track.
default Indicates that the track should be enabled by default when another track is not more appropriate for the user's preferences.

Common Mistakes

Do not use subtitles and captions interchangeably. Captions include important non-dialogue audio information, while subtitles primarily provide dialogue transcription or translation.

When using kind="subtitles", include the srclang attribute to identify the language of the subtitle track.

Do not use values other than subtitles, captions, descriptions, chapters, or metadata. An invalid value is treated as metadata.

Browser Support

Baseline: Widely available indicates a feature has been supported by core browsers for at least 30 months. At this stage, the feature is considered stable and safe for most websites to use without needing to worry about compatibility issues or fallbacks, as it is supported by the vast majority of users' devices and browser versions.

The kind attribute on the <track> element is widely supported in current core browsers. Support for how individual track kinds are presented can vary.

Checking Browser Support

For current browser compatibility information, visit Can I Use? . Search for the HTML element or attribute you want to check. You can also narrow your search by entering an element name and attribute name separated by a colon. Search results can include related HTML features, element attributes, input types, APIs, and other technologies, so select the result that most closely matches the feature you are checking.

Try the kind Attribute

The example shows how the kind attribute identifies a text track as captions. The srclang attribute identifies the language, while label provides a readable name for the track.

Play in Editor

Summary

The HTML kind attribute defines the purpose of a <track> element associated with audio or video content. Its valid values are subtitles, captions, descriptions, chapters, and metadata. If the attribute is omitted, the default is subtitles.