HTML5 audio controls, Discuss the controls attribute of audio tag.


 

HTML5 audio controls, Discuss the controls attribute of audio tag.

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

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

HTML5 audio controls, Discuss the controls attribute of audio tag.

Introduction:

The controls is attribute of audio. which is used for showing media player on browser. It supports only Boolean value. If it is present in audio tag. Media will be shows on screen otherwise not..

Controls attribute:
Attribute Value Description
controls Boolean If it is present in audio tag file; music controls will be display on screen.

Declaration Syntax :

Declaration syntax of autoplay attribute  in HTML5.

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

Example of <audio> in HTML5:

Code:
AudioControls.html
<!DOCTYPE html >
<html >
<head>
<title>Controls attributes.</title>
</head>
<body>
<p><b>Example of controls attributes in HTML5.</b></p>
<audio src="a2.mp3" 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