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.

Example

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

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.

Related tags

AttributesDescription
<video> Video tag adds a video in a page.
<video controls> <source src="address of video" > </video>

Global Attributes

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

Tag omission

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

Specific Attributes

AttributesDescription
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?

 

Email:

Message:

Get the newsletter