HTML <source> tag

You are Here:

HTML <source> tag

The <source> tag specifies multiple media resources for the <audio>, the <video> element, or the <picture> element.

Note: The <source> tag is an empty element, It has no end tag.

It is commonly used to serve the same media content in multiple formats supported by different browsers.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <video style="width:100%;height:330px" controls> <source src="/hawk.mp4" type="video/mp4"> </video> </body> </html>

Attributes

The following are the attributes of <source> tag. Also try Global attributes.

AttributeValueExplanation
srcURLSpecifies the URL of the media file. Mandatory with <audio> and <video>.
srcsetURLSpecifies the URL of the image which is to be displayed at a particular media screen.
mediamedia_querySpecifies the size of the screen.
sizespxSpecifies the final rendered width of the image represented by the source.
typeMIME_typeSpecifies the MIME-type of the resource.

Reminder

Hi Developers, we almost covered 99.5% of HTML Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in HTML.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author