Video in html
The <video> tag allows you to embed video files in your webpage, with controls for playing, pausing, and adjusting the volume.
Basic Video Example
<video controls width="600">
<source src="video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<video> Tag Attributes
Attribute | Description | Example |
---|---|---|
src | Specifies the video file URL | <video src="video.mp4"></video> |
controls | Displays video controls (play, pause, volume) | <video controls> |
autoplay | Starts playing the video automatically (must be muted for autoplay to work) | <video autoplay muted> |
loop | Repeats the video after it ends | <video loop> |
muted | Starts the video without sound | <video muted> |
poster | Specifies an image to show before the video starts playing | <video poster="thumbnail.jpg"> |
width | Sets the width of the video (in pixels) | <video width="600"> |
height | Sets the height of the video (in pixels) | <video height="400"> |
playsinline | Ensures the video plays inside the browser on mobile (instead of full screen) | <video playsinline> |