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.


You must also read

  • HTML audio tag to display audio source in HTML.

This is the example to show video using source tag.


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 tagDescription
1mp3Used to include mp3 extension files.
2oggUsed to include ogg extension files.
3wavUsed to include wav extension files.
4mp4Used to include mp4 extension files.
5webmUsed to include webm extension files.

List of HTML source tag attributes

Sr. No.attribute optionsDescription
1srcUsed to include location of media resources. The value for this attribute is the url of the media video/audio files.
2typeUsed 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.
3autoplayUsed 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.