Tutorials

KodeKite Tools

HTML
Flexbox
SVG
Canvas
HTML Tutorial

More


HTML Audio Element
Audio Element

Audio is a HTML5 element used to insert audio or voice clips in a document, it has controls attribute.

Syntax

<audio controls>
<source src="URL" type="audio/mp3">
</audio>


You can define one or more than one audio element in a document.


Example


You can use two to three audio formates such as .mp3, .ogg, .Wav in audio element. Controls attribute used to control the audio such as play, pause, stop, volume etc.

Omitting Controls

If you can omit controls attribute from audio element it will not work and nothing will appears.


Example


When you omit controls attribute from audio it will not work untill you insert controls attribute in audio element


Practice Task

Open notepad or any other text editor, follow the following points.


  • Use <audio> element to insert audio
  • Inside audio use <source> element to insert any formate audio
  • Insert text "Sorry your browser does not support audio element" to audio element
  • Don't omit controls attribute

save file with name task.html or task.htm and then open it using any browser and see results.


Solution