<source> - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:source

Description

The <source> element sets multiple alternative media resources for the media elements like <audio> and <video>.

Summary

Permitted Parent A media element, like <audio> or <video>
Content None. It is an empty element.
Start/End TagStart tag: required, End tag: forbidden
Version New in HTML5

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html lang="en">
 <head>
  <title>Example of HTML source Tag</title>
 </head><!--from  w  w  w .ja v a2s .c  om-->
 <body>
  <video controls="controls">
   <source src="your.mp4" type="video/mp4">
   <source src="your.ogv" type="video/ogg"> Your browser does not support the HTML5 Video element.
  </video>
 </body>
</html>

Tag-Specific Attributes

The following table shows the attributes that are specific to the <source> tag.

Attribute Require Value Description
src Required URL URL of the media file.
media Optionalmedia-query type of the media resource
type Optional media-type media type of the media resource.

Related Tutorials