The <video>
element allows embedding videos directly into webpages. It supports multiple attributes for better control and user experience.
<video>
controls
→ Adds play, pause, volume, and fullscreen buttons.autoplay
→ Plays video automatically (often requires muted
).muted
→ Mutes the video by default.loop
→ Makes the video replay continuously.poster
→ Displays an image before the video starts.width
& height
→ Defines video size.
<video width="600" controls autoplay muted loop poster="thumbnail.jpg">
<source src="video.mp4" type="video/mp4">
<source src="video.webm" type="video/webm">
Your browser does not support the video tag.
</video>
<source>
elements ensure cross-browser compatibility.
<source>
elements.controls
, autoplay
, and loop
.