HTML <video> Tag
Description
The <video>
HTML element is used to specify video on an HTML document. For example, you could embed a music video on your web page for your visitors to listen to and watch.
Any content between the opening and closing <video>
tags is fallback content. This content is displayed only by browsers that don't support the <video>
tag.
Properties
- Permitted Parents
- Any element that accepts embedded content
- Content
- <source>, <track>, and text
- Start/End Tags
- Start tag: required, End tag: required
Example
<video width="300" height="240" controls>
<source src="audio/toy.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
Attributes
Attribute | Definition |
---|---|
autoplay | Specifies that the video will start playing as soon as it is ready |
controls | Specifies that video controls should be displayed (such as a play/pause button etc). |
height | Sets the height of the video player |
loop | Specifies that the video will start over again, every time it is finished |
muted | Specifies that the audio output of the video should be muted |
poster | Specifies an image to be shown while the video is downloading, or until the user hits the play button |
preload | Specifies if and how the author thinks the video should be loaded when the page loads |
src | Specifies the URL of the video file |
width | Sets the width of the video player |
Global Attributes
The <video>
tag also supports the Global Attributes in HTML5
Event Attributes
The <video>
tag also supports the Event Attributes in HTML5
Browser Support
The following table will show you the current browser support for the HTML <video>
tag.
Desktop | |||||
12 | 3 | 3.5 | 10.5 | 3.1 |
Tablets / Mobile | |||||
18 | 4 | 14 | 3 | 1 | 4.4 |
Last updated by CSSPortal on: 30th March 2024