HTML5 source element, Implementation of <source> tag.


 

HTML5 source element, Implementation of <source> tag.

In this section, you will see the implementation of <source> tag of HTML5.

In this section, you will see the implementation of <source> tag of HTML5.

HTML5 source element, Implementation of <source> tag.

Introduction:

Here, we will see the implementation and use of <source> tag in HTML5. It is used for embedding media resource in media element. It is not available in HTML 4.01. It is nothing itself. So media tag(audio or video) is important for <source> tag.

Attribute of audio tag:

1-src
2-type
3-media

Declaration Syntax :

Declaration syntax of source tag in HTML5.

<media element>
                    <source src="URL" >  
                          <source src="URL">  
                                   ...................................
          </media element>

Example of <source> in HTML5:

Code:
Source_Tag.html
<!doctype html >
<html >
<head>
<title>Source Tag </title>
</head>
<body>
<p><b>Example of source tag in HTML5.</b></p>
<audio controls="controls" >
<source src="a1.mp3">
<source src="a2.mp3">
Browser does not support audio tag.
</audio>
</body>
</html>
Output:

Download this code

Difference Between HTML5 and HTML4.01:

The audio tag  is only available in HTML5. It is not available in HTML4.01.

Ads