WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

HTML <audio> Tag


Example

Play a sound:

<audio controls autoplay> <source src="horse.ogg" type="audio/ogg"> <source src="horse.mp3" type="audio/mpeg"> </audio>
Try it yourself »

Definition and Usage

<audio> Tags define sounds, such as music or other audio streams.

Current´╝î<audio> Element supports 3 file formats: MP3, Wav, Ogg.


Differences Between HTML 4.01 and HTML5

The <audio> tag is new in HTML5.



Attributes

= New in HTML5.

attribute value description
autoplay autoplay If this attribute is present, the audio plays as soon as it is ready.
controls controls If this property is present, audio controls (such as a play /pause button) are displayed to the user.
loop loop If this attribute appears, playback will restart whenever the audio ends.
muted muted If this attribute appears, the audio output is muted.
preload auto
metadata
none
Specifies whether and how audio is loaded by default when a web page loads.
src URL Specifies the URL of the audio file.