HTML <source> tag

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

When writing in HTML (hypertext markup language), the <source> tag designates 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, and related attributes and browser compatibility.

Example of <source> code

<audio controls="controls">
Your browser does not support the &lt;audio&gt; tag. <source src="https://www.computerhope.com/jargon/m/example.mp3" /> </audio>

Example result

Attributes

All HTML tags support standard attributes that define the settings of an HTML element. In addition to the standard settings, the <source> tag has the following unique attributes.

Attribute Description
media Designates the type of media resource.
src Designates the URL (uniform resource locator) of the media file.
type Designates the MIME-type of a resource.

Compatibility

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