HTML5  audio tag example, Use of audio tag  in HTML5.


 

HTML5  audio tag example, Use of audio tag  in HTML5.

In this section, you will see the use and implementation of audio tag.

In this section, you will see the use and implementation of audio tag.

HTML5  audio tag example, Use of audio tag  in HTML5.

Introduction:

In this section, you will see the use and implementation of audio tag in HTML5. The <audio> tag is used to add audio in web page or HTML page. When audio tag is not used, browser asks for plugin or script for playing audio or music. It is a paired tag.

The Content present in audio tag will be displayed only when browser does not support.

Attribute of audio tag:

Attribute is used for providing more information to the browser about the tag. There are following attributes in audio tag:

1-autoplay
2-autobuffer
3-controls
4-loop
5-preload
6-src

Declaration Syntax :

Declaration syntax of audio tag in HTML5.

                            <audio src="URL"></audio>

The declaration of audio is case_ insensitive.

Example of <audio> in HTML5:

Code:
AudioTag.html
<!DOCTYPE html >
<html >
<head>
<title>Audio Tag </title>
</head>
<body>
<p><b>Example of audio tag in HTML5.</b></p>
<audio src="a1.mp3" controls="controls" >
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