HTML label Attribute
The HTML label Attribute is used to specify the title of the Text Track. The title of the Text Track is used by the browser when listing available text tracks. It is used in <track> element.
Syntax:
<track label="English">
HTML label Attribute Supported Tags:
HTML label Attribute Example
Example: Here is the basic implementation of HTML label Attribute.
<!DOCTYPE html>
<html>
<head>
<style>
body {
text-align: center;
}
h1 {
color: green;
}
</style>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h2>HTML label Attribute</h2>
<video width="100"
height="100"
controls>
<track src=
"https://write.geeksforgeeks.org/wp-content/uploads/11.mp4"
id="myTrack1"
kind="subtitles"
srclang="en"
label="English"
default>
<source id="myTrack"
src=
"https://write.geeksforgeeks.org/wp-content/uploads/11.mp4"
type="video/mp4">
</video>
</body>
</html>
Output:

Explanation:
- In the above example we sets up a video player with controls for playback.
- It includes a track element for subtitles in English.
- The source element specifies the video file.
- The styling centers the content and sets the color of the h1 element to green.
HTML label Attribute Use Cases
1.What is the use of label Attribute in HTML ?
The label attribute in HTML is used to provide a text label or description for an element, such as an input field or a form control, improving accessibility and user experience.
Supported Browsers
The browsers supported by label Attribute are listed below:
HTML label Attribute – FAQs
Is the label attribute mandatory for the <track> element?
No, the label attribute is not mandatory, but it is recommended for providing a clear name for the track, especially when multiple tracks are available.
What are the common values for the label attribute in HTML?
Common values for the label attribute include descriptive names like “English Subtitles,” “French Captions,” or “Scene Descriptions” to help users select the appropriate track.
Can the label attribute be used outside of the <track> element?
No, the label attribute in this context is specific to the <track> element within <audio> and <video> tags to identify text tracks.
What happens if the label attribute is omitted?
If the label attribute is omitted, the track might appear without a descriptive name in the media player’s track selection menu, potentially confusing users, especially if multiple tracks are available.
Can the label attribute be localized or translated?
Yes, the label attribute can be localized to provide translated names for tracks, ensuring they are understandable to users in different languages.