×

Html & Html5

The World's best Software Development Study Portal

HTML audio tag


This <audio> tag is use to attach audio clips such as music sounds or other clips etc. into your website. But currently three type of file format is supported by HTML5.
These are as follows:-


  1. mp3
  2. wav
  3. ogg

Let's see how audio file imports in HTML5 through an example:-


<audio controls="controls" src="media/song.mp3"> Your browser not support this file </audio>

Output:




Some more attributes of HTML audio tag


Attribute Description
controls It defines the audio controls which is displayed with play/pause buttons.
autoplay It specifies that the audio will start playing as soon as it is ready.
loop It specifies that the audio file will start over again, every time when it is completed
muted It is used to mute the audio output.
preload It specifies the author view to upload audio file when the page loads.
src It specifies the source URL of the audio file.


\