Html5 Source Tag

Source tag is new in Html5. which source tage is use to media element such as <video> and <audio>.

Example Code

<audio controls="controls">
  <source src="mp3-format.ogg" type="audio/ogg" />
  <source src="mp3-format.mp3" type="audio/mpeg" />
  Your browser does not support the audio element.

In the above audio tag is use to playing for audio files and source tag is use to refer the audio source.

Attribute :

  • Media : Media attribute value is media query. which is default value is all and it specifies to what media resource.
  • Src: Src attribute value is Url. which is use to url for the media.
  • Type :Type attribute value is MIME_type.which is specifies the MIME type for the media elements.