Easy Tutorial
❮ Att A Type Tag Strike ❯

HTML <audio> src Attribute

HTML <audio> Tag

Example

Play audio:


Browser Support

Internet Explorer 9+, Firefox, Opera, Chrome, and Safari support the src attribute. However, not all browsers support the audio file format.

Note: Internet Explorer 8 and earlier versions do not support the <audio> tag.


Definition and Usage

The src attribute specifies the URL of the audio file.

Audio in the Ogg file format can be played in Firefox, Opera, and Chrome.

To play audio in Internet Explorer and Safari, an MP3 file must be used.

To ensure compatibility across all browsers, use the <source> element within the <audio> element. The <source> element can link to different audio files, and the browser will use the first recognized audio file format.

Example


Differences Between HTML 4.01 and HTML5

The <audio> tag is new in HTML5.


Syntax

Attribute Values

Value Description
URL Specifies the URL of the audio/video source. Possible values: Absolute URL - points to another website (e.g., src="http://example.com/movie.ogg")<br>Relative URL - points to a file within the website (e.g., src="/data/movie.ogg")

HTML <audio> Tag

❮ Att A Type Tag Strike ❯