Tag Description
The video tag is used to define video, such as a movie clip or other video streams.
This tag has the form:
<video
autoplay
controls
height="pixels"
loop
muted
poster="url"
preload="auto|metadata|none"
src="url"
width="pixels">
fallback_content
</video>
Note: The optional fallback_content is rendered by browsers that do not support the video tag.
The MIME types for the HTML5 video formats are:
- MP4 = video/mp4
- WebM = video/webm
- Ogg = video/ogg
HTML5 and HTML4.01 Differences
This tag is new for HTML5.
HTML5 | = New for HTML5 |
Attributes
Attribute | Value | Description |
---|---|---|
autoplayHTML5 | autoplay | Specifies that the video will start playing as soon as it is ready |
controlsHTML5 | controls | Specifies that controls will be displayed (such as a play button) |
heightHTML5 | pixels | Specifies the height of the video player |
loopHTML5 | loop | Specifies that the video will start over again, every time it is finished |
mutedHTML5 | muted | Specifies that the audio output of the video should be muted |
posterHTML5 | URL | Specifies an image to be shown while the video is downloading, or until the user hits the play button |
preloadHTML5 | auto
metadata none |
Specifies that the video should be loaded when the page loads |
srcHTML5 | URL | (required) Specifies the URL of the video to play
Possible values: An absolute URL - points to another web site (like src="http://www.example.com/movie.ogg") A relative URL - points to a file within a web site (like src="movie.ogg") |
widthHTML5 | pixels | Specifies the width of the video player |
Global Attributes
This tag also supports the HTML Global Attributes.
Event Attributes
This tag also supports the HTML Event Attributes.
Examples
The following example shows the basic use of this tag:
<video src="movie.ogg" controls="controls" width="260">
Video element not supported
</video>
This examples makes use of the <source>
tag to provide the most flexibility for browser support::
<video controls="controls">
<source src="movie.ogg" type="video/ogg" />
<source src="movie.wav" type="video/mp4" />
Video element not supported
</video>
Browser Support
Codec | Chrome | Firefox | IE | Opera | Safari |
---|---|---|---|---|---|
MP4 | 6 | 21 | 25 | ||
WebM | 6 | ||||
Ogg | 6 |
Doctype Declaration Support
The following table lists the doctype declarations this element may appear in:
HTML4.01 / XHTML1.0 | XHTML 1.1 | HTML 5 | ||
---|---|---|---|---|
Traditional | Strict | Frameset | ||
Miscellaneous Information
Defined In: | HTML5 |
---|---|
Empty Tag: | No |