HTML5 <source> Tag
ExampleAn audio player with 2 different source files:
Try it yourself » |
Definition and Usage
The <source> tag defines media resources for media elements, such as <video> and <audio>.
Differences Between HTML 4.01 and HTML5
The <source> tag is new in HTML5.
Attributes
New : New in HTML5.
Attribute | Value | Description |
---|---|---|
mediaNew | media query | Specifies what media/device the media resource is optimized for. Default value: all. |
srcNew | url | The URL of the media |
typeNew | MIME_type | Specifies the MIME type of the media resource |
Standard Attributes
The <source> tag also supports the Standard Attributes in HTML5.
Event Attributes
The <source> tag also supports the Event Attributes in HTML5.