HTML Source Tag || Source Tag in HTML
×

HTML SOURCE <source> Tag

1772

The HTML SOURCE tag was introduced in HTML5. The tag is used to define multiple media resources for media elements, such as <video>, <audio> and <picture>.

This is necessary to achieve the best possible cross-browser compatibility: from the possible options browser can choose the format, which supports and play audio and video files without any difficulty.

The tag can be used multiple times in one document to indicate the alternative audio/video files and images of numerous formats. It is used to provide the same media content with different formats such as mp3, mp4, avi, ogg, etc.

When we embed multiple resources with the same content but different formats then the browser may choose the most compatible format and display or play that media file.


Program:

<!DOCTYPE html>
<html>
<head>
<title>HTML Source Tag</title>
</head>
<body>
 <h2>Example of Source tag</h2>
 <audio controls>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<p><strong>Note:</strong> The source tag is not supported in Internet 
Explorer 8 and earlier versions.</p>
</body>
</html>

Output:




Best WordPress Hosting


Share:


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price



Leave a Reply


Comments
    Waiting for your comments