HTML - <source> tag



The HTML <source> tag is used for defining multimedia resources for <audio> and <video> elements. The browser can make a choice from the source based on media type and codec support.


<!Doctype html>

      <title>HTML source Tag</title>

      <audio controls>
         <source src = "yourfile.mp3">
         <p>The browser doesnot support the file</p>


This will produce the following result −

Global Attributes

This tag supports all the global attributes described in − HTML Attribute Reference

Specific Attributes

The HTML <source> tag also supports the following additional attributes −

Attribute Value Description
media HTML-5 media_query defines the type of media resource
src HTML-5 URL URL of the media file
type HTML-5 media_type media type of media resource

Event Attributes

This tag supports all the event attributes described in − HTML Events Reference

Browser Support

Chrome Firefox IE Opera Safari Android
Yes (4.0) Yes (3.5) Yes (9) Yes (10.5) Yes (4.0) No