The video
tag, or Video Embed element, embeds video content in an HTML document.
Text within the <video>
tag is only displayed in browsers that do not support it. The <video>
tag contains one or more <source>
tags, each with a URL to a media file.
<video width="600" height="400" controls>
<source src="videoname.mp4" type="video/mp4">
<source src="videoname.ogg" type="video/ogg">
This browser does not support the video tag.
</video>
autoplay
If included, the video will immediately begin playing as soon as enough of the file is loaded. This is a Boolean value.
controls
When present, the browser renders controls for video playback, such as play, pause/resume, etc.
height
Provides the height of the video in pixels.
loop
When specified, the video will replay from the beginning every time it finishes.
muted
When specified, the audio output of the video will be muted.
poster
Provides the URL address of an image file to be displayed while the video is downloading or until the user presses the play button if autoplay is not enabled.
preload
This tells the browser how the video should be loaded when the page loads. Allowed values are auto
, metadata
, and none
.
src
Provides the URL of the video file.
width
Provides the width of the video in pixels.
User-submitted codepen.io examples of <video>
↴
Submit a codepen.io link that demonstrates <video>
: