Category: html_css
how to load video in html page
Published on 25 May 2026
Explanation
The <video> tag is used to
display videos in an HTML page.
Code:
<video></video>
Explanation
The src attribute defines the video
file path.
The controls attribute shows play, pause,
and volume buttons.
Code:
<video src='movie.mp4'></video> <video src='movie.mp4' controls></video>
Explanation
Width and height attributes set the
video size.
Code:
<video src='movie.mp4' controls width='500' height='300'></video>
Explanation
The autoplay attribute automatically
starts the
video.
Code:
<video src='movie.mp4' autoplay controls> </video>
Explanation
The loop attribute repeats the video
continuously.
Code:
<video src='movie.mp4' loop controls> </video>
Explanation
The muted attribute starts the video
without sound.
The poster attribute displays an image
before the video starts.
Code:
<video src='movie.mp4' muted controls> </video> <video src='movie.mp4' poster='thumbnail.jpg' controls> </video>
Explanation
Using the <source> tag allows multiple
video formats.
You can embed a YouTube video
using an iframe.
Code:
<video controls> <source src='movie.mp4' type='video/mp4'> <source src='movie.webm' type='video/webm'> </video> <iframe width='560' height='315' src=' https://www.youtube.com/embed/T5kjRGmfjsc'> </iframe>