<source>
EmbeddedSelf-closingSpecifies multiple media resources for video, audio, or picture elements, allowing the browser to choose the best format.
Common Attributes
srctypesrcsetsizesmediaExample
<video> <source src="movie.mp4" type="video/mp4"> <source src="movie.webm" type="video/webm"> </video>
About the <source> Element
The <source> HTML element belongs to the Embedded category of HTML elements. Specifies multiple media resources for video, audio, or picture elements, allowing the browser to choose the best format. Understanding when and how to use this element is essential for building well-structured, accessible, and SEO-friendly web pages.
As a void (self-closing) element, <source> does not have a closing tag. It is written as <source> or <source /> in XHTML syntax. This element is part of the current HTML Living Standard and is supported in all modern browsers including Chrome, Firefox, Safari, and Edge.
Proper use of semantic HTML elements like <source> improves document structure, helps screen readers interpret content correctly, and provides signals to search engines about the purpose of different sections of your page. This leads to better accessibility scores, improved SEO rankings, and more maintainable code.