HTML source tag

HTML source tag is used to show media resources in web pages. The audio tag and video tag are the media resources which we can show inside a web page.


This is the example to show audio using source tag.

Output


You must also read

  • HTML audio tag to display audio source in HTML.

This is the example to show video using source tag.

Output


You must also read

  • HTML video tag to display video source in HTML.

List of allowed HTML Audio/Video Formats

Sr. No. HTML Audio/Video availble formats for source tag Description
1 mp3 Used to include mp3 extension files.
2 ogg Used to include ogg extension files.
3 wav Used to include wav extension files.
4 mp4 Used to include mp4 extension files.
5 webm Used to include webm extension files.

List of HTML source tag attributes

Sr. No. attribute options Description
1 src Used to include location of media resources. The value for this attribute is the url of the media video/audio files.
2 type Used to specify the type of the media files whether it is video or audio extension files. video/mp4, audio/mp3 etc are the values for this attribute.
3 autoplay Used to specify the boolean value to start and play the sources. The value for this are true and false.

Resources and References

1. W3C Specification.
2. HTML living standard
3. W3C project using Github

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

ULTIMATE TOOLKIT Free eBook

Get FREE Access to Toolkit and Resources that we are using in Tutorialdeep that Every Professional Should Have! in one handy PDF.

Download Link Will be Send to Your Email id