Description

The <audio> element is used to embed audio content in an HTML document without requiring any additional plug-in like Flash player.

The following table summarizes the usages context and the version history of this tag.

Placement:Block
Content:<source>, <track>, and text
Start/ End Tag:Start tag: required, End tag: required
Version:HTML 5

Syntax

The basic syntax of the <audio> tag is given with:

HTML/XHTML: <audio> ... </audio>

Note: In HTML, the end tag for the <audio> tag is forbidden. In XHTML, the <audio> tag must be closed with a trailing slash, like this: <audio /> . See empty elements.

The example below shows the <audio> tag in action.

<audio controls="controls" src="birds.mp3">
    Your browser does not support the HTML5 Audio element.
</audio>               

An audio, using the browser default set of controls, with alternative sources.

<audio controls="controls">
    <source src="birds.mp3" type="audio/mpeg">
    <source src="birds.ogg" type="audio/ogg">
    Your browser does not support the HTML5 Audio element.
</audio>              

Tip: You can place content such as text or download link inside an audio element to provide alternate content in case, if the browser does not support the audio content or somehow failed to download the audio source file.

Tag-Specific Attributes

The following table shows the attributes that are specific to the <audio> tag.

Global Attributes

Like all other HTML tags, the <audio> tag supports the global attributes in HTML5.

Event Attributes

The <audio> tag also supports the event attributes in HTML5.

Browser Compatibility

Element
<audio>YesYesYesYesYes