<audio>

Description

The <audio> element embeds audio content into an HTML document. You specify the audio source using the src attribute.

Example

The following HTML code uses audio tag to include a mp3 format audio file into a HTML document


<!DOCTYPE HTML>// w w w .j  a  v a 2 s  . com
<html>
<body>
      <audio controls src="mytrack.mp3" autoplay> Audio content
            cannot be played
      </audio>
</body>
</html>

Provide Multiple Audio Formats

The following examples show how to use the source element to provide multiple audio formats.


<!DOCTYPE HTML>/*w  w w. j a va2s  . co m*/
<html>
<body>
      <audio controls autoplay>
            <source src="mytrack.ogg" />
            <source src="mytrack.mp3" />
            <source src="mytrack.wav" />
            Audio content cannot be played
      </audio>
</body>
</html>




















Home »
  HTML CSS »
    HTML CSS Reference »




HTML Tag Reference
CSS Reference
CSS Selector Reference
Encoding Reference