HTML source tag

HTML <source> tag has no special meaning at all. But as a child of other media elements such as video or audio, it can embed video or audio.

<video height="300" width="300" controls>
  <source src="files/Hummingbird.mp4" type="video/mp4">
 </video>
</>

More than one source elements can be used as a child of audio or video elements for the same video but with different type. In this case, if the browser does not support one type of media, then another type is executed.

Tag omission

Both starting and ending tags are necessary for the source tag.

Global Attributes

All the global attributes are applicable on the <source> element.

Tag Attributes

Attributes that are applicable to <source> tag
src

The address of the media(audio/video).

<video controls> <source src="address of video" > </video>
type

Type of media source.

<video controls> <source src="address of video" type="video/mp4" > </video>


Was this article helpful?