HTML5 source label: media elements define media resources, html5source
The HTML5 source tag is a media element (such as <video> and <audio>) to define media resources. <Source> the tag allows you to specify a replaceable video/audio file for the browser to select media type or encoding/decoding support. Here, the host will introduce the application attributes and instances of the source tag.
<Source>Tag attributes:
Attribute |
Value |
Description
|
Media |
Media query |
Specifies the media resource type. |
Src |
Url |
Specifies the URL of a media file. |
Type |
Numeric value |
Specifies the MIME type of a media resource. |
<Source> tags support global attributes and event attributes in HTML.
Application instance:
An audio player with two source files. The browser should select the files it supports (if any ):
<audio controls> <source src="horse.ogg" type="audio/ogg"> <source src="horse.mp3" type="audio/mpeg"> Your browser does not support the audio element.</audio>
Output:
Differences between HTML 4.01 and HTML 5
<Source> A tag is a new tag in HTML 5.