The <video> element plays video files directly on your page.
Useful attributes
controls— play, pause, volume and full screen buttons.width/height— the player size.poster="image.jpg"— an image shown before the video starts.autoplay muted loop— a silent looping background video.
Tip: For YouTube videos, use an
<iframe>(see HTML Iframes) instead of<video>.
Examples
Example — Video player
HTML
<video controls width="360" poster="https://www.w3schools.com/html/pic_trulli.jpg">
<source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
Your browser does not support video.
</video>
Example — Responsive video
HTML
<style>
video { max-width: 100%; height: auto; }
</style>
<video controls>
<source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
</video>
max-width: 100% keeps the video inside small screens.
Try it Now »