html tutorial - default Attribute in HTML - html5 - html code - html form



default Attribute in HTML

Learn html - html tutorial - default Attribute in HTML - html examples - html programs

  • The default attribute is a Boolean attribute.
  • The default attribute is used to set the specified <track> as default.
  • If the default attribute present that the track will be selected as default while the video load.

Syntax for default attribute in HTML:

<track default>

Difference between HTML 4.01 and HTML 5 for default Attribute:

HTML 4.01

  • HTML 4 does not support <track> element.

HTML 5

Applies To:

Element Attribute
<track> default

Sample Coding for default Attribute in HTML:

Tryit<!DOCTYPE html>
<html>
    <head>
        <title>Wikitechy default attribute</title>
    </head>
    <body>
        <h2>HTML default attribute with example.</h2>
        <video width="350" height="300" controls>
            <source src="hibiscus.mp4" type="video/mp4">
            <track src="subtitles_sp.vtt" kind="subtitles" srclang="es" 
            label="Spanish">
            <track src="subtitles_en.vtt" kind="subtitles" srclang="en" 
            label="English" default>
        </video>
    </body>
</html>

Code Explanation for default Attribute in HTML:

default Attribute Code Explanation

  1. The <video> tag is used to embed the video file.
  2. The <source> tag is used to set the source file as “hisbiscus.mp4”.
  3. The <track> tag is used to include a Spanish subtitle file.
  4. The <track> tag is used to include an English subtitle file.
  5. default attribute is used to set the English subtitle as default.

Output for default Attribute in HTML:

    default Attribute Output
  1. The output shows the subtitle in English which is specified default.
  2. User can change the subtitle by click the subtitle icon.
  3. User can select the subtitles from the list.
  4. default Attribute Output
  5. If user select the Spanish subtitle that will be selected.

Browser Support for default Attribute in HTML:

18.0 10.0 31.0 6.0 15.0

Related Searches to default Attribute in html