Open In App

HTML label Attribute

Improve
Improve
Like Article
Like
Save
Share
Report

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.

HTML




<!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=
               id="myTrack1" 
               kind="subtitles" 
               srclang="en"
               label="English" 
               default>
  
            <source id="myTrack" 
                    src=
                    type="video/mp4">
  
    </video>
</body>
  
</html>


Output: 

HTML label attribute

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: 



Last Updated : 11 Mar, 2024
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads