HTML5 <source> Tag


An audio player with 2 different source files:

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

Try it yourself »

Definition and Usage

The <source> tag defines media resources for media elements, such as <video> and <audio>.

Differences Between HTML 4.01 and HTML5

The <source> tag is new in HTML5.


New : New in HTML5.

Attribute Value Description
mediaNew media query Specifies what media/device the media resource is optimized for. Default value: all.
srcNew url The URL of the media
typeNew MIME_type Specifies the MIME type of the media resource

Standard Attributes

The <source> tag also supports the Standard Attributes in HTML5.

Event Attributes

The <source> tag also supports the Event Attributes in HTML5.