The HTML <audio>
tag is used to embed an audio content on the website by containing one or more audio sources with <source>
tags.
The <audio>
tag supports MP3, WAV, and OGG audio content.
File Format | Media Type |
MP3 | audio/mpeg |
OGG | audio/ogg |
WAV | audio/wav |
Demo
<audio controls>
<source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
Output
Note: To display the audio player correctly, the controls
attribute need to be added to play, pause or changing the volume of the player.
Browser Compatibility
Browser | Chrome | Edge | Firefox | Opera | Safari |
<audio> | Yes | Yes | Yes | Yes | Yes |