HTML 5 Audio Tag

HTML5 Audio Tag

HTML5 <audio> tag is used to insert audio message inside the HTML document.

General Syntax

General Syntax

Try it now

Source Code

Try it now

Source Code : Output

Multiple Audio

You can also place multiple audio formats of the same file. The browser will select the first one that will be able to play.

General Syntax

Try it now

Source Code

Try it now

Source Code : Output

Audio Attributes

Followings are the audio attributes:

  • src - It is used to provide an audio file path.
  • controls - It is used to create a control for play/pause, volume, etc.
  • autoplay - It is used to play audio files automatically when the page is loaded.
  • loop - It specifies that the audio will play again after the end.

General Syntax

Try it now

Source Code

Try it now

Source Code : Output