The <video> tag is used to add videos to the HTML page. Video tag currently supports MP4, WebM, and Ogg formats.
Example
<video width="250" height="250" autoplay>
<source src="video.mp4" type="video/mp4">
Video tag is not supported
</video>
Optional Attribute
Attribute | Values | Description |
autoplay | autoplay | Specifies that the video will start playing as soon as it is ready. |
control | control | Specifies that video controls should be displayed (such as a play/pause button etc). |
height | pixel | Sets the height of the video player |
loop | loop | Specifies that the video will start over again, every time it is finished |
muted | muted | Specifies that the audio output of the video should be muted |
poster | URL | Specifies an image to be shown while the video is downloading, or until the user hits the play button |
preloaded | Specifies if and how the author thinks the video should be loaded when the page loads | |
src | URL | Specifies the URL of the video file |
width | pixel | Sets the width of the video player |
Things to remember
- Most browsers support the MP4 format.
- Autoplay may not work on some browsers.
Subscribe
Join the newsletter to get the latest updates.