HTML <source> Tag


The <source> HTML element 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.


Permitted Parents
A media element—<audio> or <video>—and it must be placed before any flow content or <track> element. A <picture> element, and it must be placed before the <img> element
None. It is an empty element.
Start/End Tags
Start tag: required, End tag: forbidden


<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

Browser Support

The following table will show you the current browser support for the HTML <source> tag.

Edge Chrome Firefox Opera Safari
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview

Last updated by CSSPortal on: 30th March 2024