HTML <source> tag
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.
Attribute | Value | Explanation |
---|---|---|
src | URL | Specifies the URL of the media file. Mandatory with <audio> and <video>. |
srcset | URL | Specifies the URL of the image which is to be displayed at a particular media screen. |
media | media_query | Specifies the size of the screen. |
sizes | px | Specifies the final rendered width of the image represented by the source. |
type | MIME_type | Specifies 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.