HTML <source> tag


It has two source files audio player. The browser should choose it supports file (if any):

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

Try it yourself

Browser Support

IE Firefox Chrome Safari Opera

Internet Explorer 9+, Firefox, Opera, Chrome and Safari support <source> tag.

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

Definition and Usage

<Source> tag for the media element (such as <video> and <audio>) define the media resources.

<Source> tag allows you to specify alternative video / audio files for browser according to its media type or codec support selection.

HTML 4.01 and HTML 5 differences between

<Source> tag is new in HTML 5 tag.


new: HTML5 new property.

Attributes value description
media media query It specifies the type of property.
src url It specifies the URL of the media file.
type numeric value MIME type specified property.

Global Properties

<source> tag supports HTML in the global properties .

Event Properties

<source> tag supports HTML in the event properties .

Related Pages

HTML DOM Reference Manual: the Source Object