HTML Tag Reference - HTML tag <source>








The <source> tag marks multiple media resources for media elements, such as <video> and <audio>.

Browser compatibility

<source> Yes Yes Yes Yes Yes

What's new in HTML5

The <source> tag is new in HTML5.

Attribute

Attribute Value Description
media media_query Set the type of media resource
src URL Set the URL of the media file
type media_type Set the media type of the media resource




Global Attributes

The <source> tag supports the Global Attributes in HTML.

Event Attributes

None.

Example

<!DOCTYPE html>
<html>
<body>

<audio controls>
<source src="sound.ogg" type="audio/ogg">
<source src="sound.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>

</body>
</html>