English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The HTML <source> element specifies multiple media resources for the <picture>, <audio>, or <video> elements. It is an empty element. It is usually used to provide the same media content in multiple formats supported by different browsers.
A video player with three source files. The browser needs to select the source file it supports (if all are supported, any can be chosen):
!doctype html <html> <head> <meta charset="UTF-8"> <title>HTML source tag usage (Basic Tutorial Website oldtoolbag.com)</title> </head> <body> <video controls> <source src="movie.webm" type="video/webm"> <source src="movie.ogg" type="video/ogg"> <source src="movie.mov" type="video/quicktime"> I'm sorry; your browser doesn't support HTML5 video. </video> </body> </html>Test and see ‹/›
IEFirefoxOperaChromeSafari
IE 9+Firefox, Opera, Chrome, and Safari all support the <source> tag.
Note:IE 8 IE and earlier versions do not support the <source> tag.
<source> tag defines media resources for media elements (such as <video> and <audio>).
<source> tag allows you to specify two videos/Audio files let the browser choose based on its support for media types or codecs.
<source> tag is in HTML5 New tag in
New: HTML5 New attribute in
Attribute | Value | Description |
---|---|---|
mediaHTML5 | media_query | Specifies the type of the media resource, for the browser to decide whether to download. |
srcHTML5 | URL | Specifies the URL of the media file. |
typeHTML5 | MIME_type | Specifies the MIME type of the media resource. |
Support for <source> tag Global attributes of HTML.
Support for <source> tag HTML event attributes.