HTML video tag
HTML

HTML video tag

Mishel Shaji
Mishel Shaji

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

AttributeValuesDescription
autoplayautoplaySpecifies that the video will start playing as soon as it is ready.
controlcontrolSpecifies that video controls should be displayed (such as a play/pause button etc).
heightpixelSets the height of the video player
looploopSpecifies that the video will start over again, every time it is finished
mutedmutedSpecifies that the audio output of the video should be muted
posterURLSpecifies an image to be shown while the video is downloading, or until the user hits the play button
preloadedSpecifies if and how the author thinks the video should be loaded when the page loads
srcURLSpecifies the URL of the video file
widthpixelSets the width of the video player

Things to remember

  • Most browsers support the MP4 format.
  • Autoplay may not work on some browsers.