The source element is used to specify multiple media resources if more than one media element is being used. The <source> tag may be used for both, videos and audios.

This element is useful when we want to add same video (or audio) but with different codes (let sat MP3 and Ogg).


<audio|video><source /></audio|video>


  • src - Provides the path of the media (video or audio) file in form of URL.
  • type - Defines a valid MIME-type of the media source (.mp3, .ogg. wav...); browser determines whether to play it or not.
  • media - Specifies resources to be used for the intended media type; typical resource data may be a device type (screen, braille...), width and height, or a certain ratio.
  • global attributes
  • event attributes


The source element in HTML5 example:


›› go to examples ››