Advertisement
Home Open Editor ❯

HTML <source> src Attribute

The <source> element src 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>

Try this code ❯

The <source> element src 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>

Try this code ❯

Meaning

The src attribute is set to the URL of the media source to link to.


Standard Syntax

HTML: <source src="URL">

XHTML: <source src="URL" />


Advertisement

Attribute Values

Value Description
URL

Value can be:

  • An absolute URL - file within or another web site ( href="http://www.example.com/index.html")
  • A relative URL - file to within a web site ( href="index.html")
Home Open Editor ❯
Advertisement