Language
日本語
English

Caution

JavaScript is disabled in your browser.
This site uses JavaScript for features such as search.
For the best experience, please enable JavaScript before browsing this site.

  1. Home
  2. HTML Tag Dictionary
  3. <video>

<video>

The video element embeds a video into an HTML page, allowing playback directly in the browser without any plugins.

Syntax

<!-- Basic video embed -->
<video src="movie.mp4" controls></video>

<!-- Multiple formats with fallback -->
<video controls width="640" poster="thumbnail.jpg">
  <source src="movie.webm" type="video/webm">
  <source src="movie.mp4" type="video/mp4">
  <p>Your browser does not support video playback.</p>
</video>

Common Attributes

AttributeDescription
srcSpecifies the URL of the video file to play.
controlsDisplays a control panel with play, pause, volume, and other controls.
autoplayStarts playback automatically when the page loads. Some browsers require the muted attribute for autoplay to work.
loopRestarts the video from the beginning when it ends.
mutedPlays the video with audio muted.
posterSpecifies the URL of an image to display before the video plays.
preloadSpecifies how the video data should be preloaded (none / metadata / auto).
width / heightSets the display size of the video in pixels.

Sample Code

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>video sample</title>
</head>
<body>

  <!-- Video with controls -->
  <video controls width="640" height="360" poster="thumbnail.jpg">
    <!-- Prefer WebM; fall back to MP4 if not supported -->
    <source src="sample.webm" type="video/webm">
    <source src="sample.mp4" type="video/mp4">
    <p>Your browser does not support video playback.</p>
  </video>

  <!-- Background video: autoplay, loop, muted -->
  <video autoplay loop muted playsinline width="320">
    <source src="background.mp4" type="video/mp4">
  </video>

</body>
</html>

Result

The first video element shows a thumbnail image and plays the video with a control panel. The second plays automatically on loop with audio muted.

┌─────────────────────────────────────────┐
│  [thumbnail.jpg displayed as thumbnail] │
│  ▶ 0:00 ───────────────────── 🔊 ⛶    │
└─────────────────────────────────────────┘

Notes

The video element was introduced in HTML5, enabling video playback in the browser without plugins such as Flash. Supported formats vary by browser, but MP4 (H.264) is now supported by virtually all modern browsers. WebM files tend to be smaller, so specifying both formats via source elements is recommended.

Even when autoplay is specified, most browsers block autoplay when audio is enabled. For background videos or other cases where silent autoplay is needed, combine autoplay with the muted attribute. On Safari for iOS, you may also need to add the playsinline attribute to prevent the video from opening in fullscreen.

To play audio only, use the audio element.

Browser Compatibility

Chrome Chrome
49+
2 or earlier ×
Firefox Firefox
57+
2.5 or earlier ×
Safari Safari
18+
3 or earlier ×
Edge Edge
80+
11 or earlier ×
IE IE
11+
8 or earlier ×
Opera Opera
48+
10 or earlier ×
iOS Safari iOS Safari
18+
2 or earlier ×
Android Browser Android Browser
37+
4 or earlier ×
Chrome Android Chrome Android
36+
17 or earlier ×
Firefox Android Firefox Android
79+
3 or earlier ×

If you find any errors or copyright issues, please .