HTML Video Tag

  • Purpose: To embed video content within an HTML document.
  • Tags: <video>
  • Attributes
    • src: Specifies the URL or path to the video file.
    • controls: Displays default video controls (play, pause, volume, fullscreen, etc.) to the user.
    • autoplay: Starts playing the video automatically when the page loads. (Note: This attribute may be restricted by browsers due to user experience concerns.)
    • loop: Makes the video loop indefinitely.
    • muted: Mutes the video by default.
    • width: Sets the width of the video player.
    • height: Sets the height of the video player.
  • Example:
<video src="video.mp4" controls width="640" height="480"></video>

This code will embed a video file named “video.mp4” and display default video controls to the user. The video player will have a width of 640 pixels and a height of 480 pixels.

Scroll to Top