source

FilterElements

HTML: <source>
XHTML: <source/>  or  <source />

HTML5 only. Used within audio and video elements, source allows authors to specify multiple versions of a media file. When source is used, the src attribute should be omitted from the audio and video elements. User agents will go down the list of source elements until they find a format they are able to play.

Start/End Tags

This is an empty element. It must be closed with a trailing slash in XHTML5.

Specifications

  • HTML5

media=

Values: all | aural | braille | handheld | print | projection | screen | tty | tv
Specifies the target display media for the audio or video file.

src=

Values: URL
Specifies the location of the audio or video file.

type=

Values: MIME type
Indicates the file type of the media file and may also include the codecs MIME parameter indicating the codec used to encode the media.
<video>
  <source src="media/vacation.ogv" type="video/ogg; codecs='theora, vorbis'">
  <source src="media/vacation.mp4" type="video/mp4">
Your browser doesn't support the <code>video</code> element.
</video>

Rendered Example

source provides information about a media file and is a non-rendering element.