HTML <source> Tag


The HTML <source> tag is used to specify multiple media resources on media elements (such as <audio> and <video>).

This element allows you to specify alternative video and audio files which the browser may choose from based on its media type or codec support.

Example Code:
<video width="300" height="240" controls>
  <source src="audio/toy.mp4" type="video/mp4">
  <source src="audio/toy.ogv" type="video/ogg">
  Your browser does not support the video tag.
Attribute Definition
src Specifies the URL of the media file
media Specifies the type of media resource
type Specifies the MIME type of the media resource
Global Attributes:

The <source> tag also supports the Global Attributes in HTML5

Event Attributes:

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