HTML Tutorial

HTML Tag: <video>

Usage of <video>

The <video> tag is used to embed videos into HTML documents. With the <video> tag, you can control the playback and appearance of the video.

Attributes of <video>

  • src: Specifies the source of the video content.
  • controls: Controls the display of playback controls for the video (e.g., play/pause, volume slider).
  • autoplay: Automatically starts the video when the page loads.
  • muted: Mutes the audio of the video.
  • width: Sets the width of the video in pixels.
  • height: Sets the height of the video in pixels.

Examples with <video>

  • Embed a video with default playback controls:
<video src="video.mp4"></video>
  • Embed a video with autoplay and muted audio:
<video src="video.mp4" autoplay muted></video>
  • Set the dimensions of the video:
<video src="video.mp4" width="640" height="480"></video>

Simple HTML Example: Exploring the <video> Tag

<!DOCTYPE html>
<html>
<body>
  <h1>Video Tag Demo</h1>
  <video src="video.mp4" controls width="640" height="480"></video>
</body>
</html>