6. Adding audio to a page


          The HTML <audio> element is used to embed sound content in documents. It may contain one or more audio sources, represented using the src attribute or the element: the browser will choose the most suitable one.

          HTML5 most commonly used audio formats are ogg, mp3, and wav. You can use the <source> tag to specify media along with media type and many other attributes. An audio element allows multiple source elements, and the browser will use the first recognized format.


<!DOCTYPE html>
<html lang="en">
 <head>
   <meta charset="UTF-8">
   <title>The HTML5 audio Element</title>
   </head>

 <body>
   <audio controls="controls">
     <source src="images/html5-audio-mp3.mp3" type="audio/mpeg">
     <source src="images/html5-audio-mp3.ogg" type="audio/ogg">
   </audio>
 </body>
</html>

This will produce the following result:

Some of the attributes that could be used with the audio tag as shown below: