HTML5 Video Tag

The HTML5 video tag is used to insert a video inside the HTML document.

Let us explain the term used inside the video tag

  • src attribute- It is used for providing video file location.
  • height - The height attribute of the video tag is used to set the height of the video.
  • control attribute- It is used to make video controls such as play/pause, mute, etc.

General Syntax

      
        <video src="URL" height="value" width="value" controls></video>      
    
Try it now

Source Code

          
            <video src="asd.mp4" height="225" width="400" controls></video>          
        
Try it now

Placing Multiple Video Inside Video Tag

You can also insert one or multiple video formats inside the video tag. The browser will choose the first one which it will be able to play.

General Syntax

      
        <video height="" width="" controls>
  <source src="URL" type="video/ogg" />
  <source src="URL" type="video/mp4" />
</video>      
    
Try it now

Source Code

          
            <video height="225" width="400" controls>
  <source src="URL" type="video/ogg" />
  <source src="URL" type="video/mp4" />
</video>          
        
Try it now

Other Video Attribute:

Let us see some other video attributes:

  • loop attribute - This attribute is used to play the video when it ends.
  • autoplay attribute - It is used to play video automatically when a web page is loaded.

General Syntax

      
        <video height="" width="" preload="none" controls autoplay loop></video>      
    
Try it now

Source Code

          
            <video height="" width="" preload="none" controls autoplay loop>
  <source src="asd.ogg" type="video/ogg" />
  <source src="asd.mp4" type="video/mp4" />
</video>          
        
Try it now

Web Tutorials

HTML 5 Video Tag
Html Tutorial HTML
Javascript Tutorial JAVASCRIPT
Css Tutorial CSS
Bootstrap 5 Tutorial BOOTSTRAP 5
Bootstrap 4 Tutorial BOOTSTRAP 4