HTML <source> type Attribute

❮ HTML <source> tag

The <source> element type attribute with <audio> element:

Example

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

The <source> element type attribute with <video> element:

Example

<video controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.webm" type="video/webm">
  Your browser does not support the audio tag.
</video>

Meaning

The type attribute is set to the MIME type of the linked media file specified by the src attribute.

It can also includes a codecs value to indicate how a media resource is encoded.


Standard Syntax

HTML: <source type="MIME-type">

XHTML: <source type="MIME-type" />



Browser Support




Status







Attribute Values

Value Description
MIME-type A string that identifies a valid MIME media type. Most common media types:

<video>

  • video/ogg
  • video/mp4
  • video/webm

<audio>

  • audio/ogg
  • audio/mpeg
❮ HTML <source> tag