What is the <video> tag in HTML?

The <video> tag in HTML

The <video> tag embeds audio files in an HTML page. The structure of the <video> tag is as follows:

<video>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Video tag is not supported in the browser
</video>

The <video> tag itself can reference video files. However, the <source> tag(s) inside the <video> tag can also provide the video files that must be embedded in the HTML page. The <source> tag requires src and type attributes. The src attribute must provide the URL to the video file, and the type attribute must provide the type of video file. The text enclosed between <video> and </video> is only displayed if the browser does not support the <video> tag.

Example usage of the <video> tag

The following code provides an example:

In the example above, the first <video> tag contains no <source> tag and has a URL specified in the src attribute. In the second <video> tag, 2 <source> tags are embedded, but only the video of the <source> tag that comes first is played. In order to play the next video specified by the second <source> tag, some Javascript code is required.

Note: The controls attribute displays the video controllers in the above example; if it is not present, the video can only be played by writing Javascript code.

Attributes

Attribute Value Description
autoplay autoplay A boolean attribute which, if present, starts playing the video file when it is ready
controls controls A boolean attribute which, if present, displays the video controller
loop loop A boolean attribute which, if present, restarts the video whenever it ends
muted muted A boolean attribute which, if present, mutes the audio output of the video
preload auto
metadata
none
Instructs the browser when to load the video file
src URL The URL of the video resource
Educative Teaser.mp4
Stacks 2.0 Teaser.mp4

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved