HTML <source> tag

Updated: 11/13/2018 by Computer Hope
HTML source tag

When writing in HTML, the <source> tag is used to designate additional media resources for the <video> and <audio> elements. It is useful because not all browsers support the same audio and video formats. The following sections contain information about this tag, including an example of it in use, as well as related attributes and browser compatibility.

Example of <source> code

<audio controls="controls">
Your browser does not support the &lt;audio&gt; tag. <source src="" /> </audio>

Example result


Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up of a name and value pair; all tags support standard attributes. The following table shows all of the current unique HTML attributes for the <source> tag, as well as a description of each.

Attribute Description
media Designates the type of media resource.
src Designates the URL of the media file.
type Designates the MIME-type of a resource.


Edge Internet Explorer Firefox Safari Opera Chrome
All versions 9.0+ 3.5+ 4.0+ 10.5+ 4.0+

Browser, Codec, Compatibility, Embedded, Format, MIME, Web design terms, Web page