HTML5 <source> Tag

Example

An audio player with 2 different source files:

<audio controls="controls">
  <source src="song.wav" type="whiteo/wav" />
  <source src="song.mp3" type="whiteo/mpeg" />
Your browser does not support the audio element.
</audio>
Code it Online »

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.

Attributes

Attribute Value Description
media media query Specifies what media/device the media resource is optimized for. Default value: all.
src url The URL of the media
type 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.


Have Any Suggestion? We Are Waiting To Hear from YOU!

Your Query was successfully sent!