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.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <style>
        body {
            text-align: center;
        }
        h1 {
            color: green;
        }
    </style>
</head>
  
<body>
    <h1>w3wiki</h1>
    <h2>HTML  label Attribute</h2>
  
    <video width="100" 
           height="100" 
           controls>
  
        <track src=
"https://write.w3wiki.net/wp-content/uploads/11.mp4"
               id="myTrack1" 
               kind="subtitles" 
               srclang="en"
               label="English" 
               default>
  
            <source id="myTrack" 
                    src=
"https://write.w3wiki.net/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

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: 



Contact Us