HTML audio tag is employed to outline sounds like music and alternative audio clips. presently there area unit 3 supported file format for HTML five audio tag.

  1. mp3
  2. wav
  3. ogg

HTML5 supports and controls. The Flash, Silverlight and similar technologies area unit accustomed play the transmission things.

This table defines that that applications program supports that audio file format.

Example:-

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Audio tag</title>
</head>
<body>

  <h1>
    HTML Audio Tag
  </h1>
<audio controls>  
  <source src="Nand Gher Anand Bhayo.mp3" type="audio/mpeg">  
Your browser does not support the html audio tag.  
</audio>  
</body>
</html>

Output:-

Audio tag

HTML Audio Tag



Attributes of HTML Audio Tag

  • controls
  • autoplay
  • loop
  • muted
  • preload
  • src

HTML Audio Tag Attributes Example

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Audio tag </title>
</head>
<body>
 

<h1>The audio Tag autoplay attribute</h1>

<p>Click on the play button to play a sound:</p>
 
<audio controls autoplay loop>  
  <source src="Nand Gher Anand Bhayo.mp3" type="audio/mpeg"></audio>  
</body>
</html>

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *