Share on Google+Share on Google+

HTML5 source element, Implementation of <source> tag.

Advertisement
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.

Advertisements

Posted on: September 15, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.