What Is The HTML <video> Tag?

What Is The HTML Video Tag

Date First Published: 24th February 2023

Topic: Web Design & Development

Subtopic: Web Development

Article Type: Computer Terms & Definitions

Difficulty: Medium

Difficulty Level: 5/10

Learn more about what the HTML <video> tag is in this article.

In HTML, the <video> tag is used to embed a video file in a HTML document, such as a film or a song. This HTML5 tag supports videos in the MP4, WebM, and OGG format, includes built-in functionality to customise how the video works on the webpage, and is supported by modern web browsers.

The <video> tag contains one or more source tags with multiple video sources. The browser will choose the first source it supports. When adding this tag to a webpage, it creates a video player with media controls, such as start, stop, volume, full screen, and more. The width and height attributes can be added to instruct the browser on how to display the video.

The HTML5 <video> tag is now one of the most commonly used ways of including video content. It allows videos to be displayed without having to rely on a plugin or browser extension. Before HTML5 was released, videos were most commonly embedded using the Adobe Flash plugin. Flash became less necessary and Adobe dropped support for Flash on 31st December 2020.

Note: Info Icon

Even though the <video> tag can play audio files, the audio tag is more suitable.


Note: Info Icon

The text between the <video> and </video> tags only displays in browsers that do not support the video element.

Example Of The <video> Tag

An example of the <video> tag can be seen below:

<video controls="controls"> Your browser does not support the <video> tag. <source src="/video/video.mp4" /> </video>

Attributes

Below are the attributes for the <video> tag.

Attribute Description
autoplay Specifies that the video will start playing as soon as it loads.
controls Specifies that video controls, such as a play/pause button should be displayed.
height Sets the height of the video player.
loop Specifies that the video should play again every time it is finished.
muted Specifies that the audio output of the video should be muted.
poster Sets an image to use until the user clicks on the play button or whilst the video is downloading.
preload Specifies how and when 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.


Feedback

  • Is there anything that you disagree with on this page?
  • Are there any spelling, grammatical, or punctuation errors on this page?
  • Are there any broken links or design errors on this page?

If so, it is important that you tell me as soon as possible on this page.


Comments