agyanadda@gmail.com

HTML Video

HTML Media 1 min read Updated Nov 30, 2026 Topic 21 of 33

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 »

Test Yourself With Exercises

Exercise 1 Multiple Choice

Which attribute shows an image before the video plays?

Exercise 2 Fill in the Blank

The most widely supported video format is ___.

Frequently Asked Questions

Usually not. Large videos use a lot of bandwidth. Upload to YouTube and embed it with an iframe.