coding180 icon

Coding180

HTML Video Element

HTML Video Element

Tutorials > HTML > HTML Elements


Similar to audio, we can also insert videos into HTML pages using the video tag, added in HTML5.

Example

<video src="video.mp4" width="640" height="480" controls>
Your browser does not support HTML5 video.
</video>

 

This time, in addition to the attributes already seen in the audio, we also need to insert the width and height of the video, in order to keep it suitable for the layout.

Below example can be used when we want to insert more than one video file as loading options, as we saw in the audio tag. 
 

In this case, the supported formats are MP4, WebM and Ogg.

<video width="640" height="480" controls>
<source src="video.webm" type="video/webm">
<source src="video.mp4" type="video/mp4">
</video>

 

The result can now be seen in below

Video running on page html example

 


user

Robort Gabriel

Lagos, Nigeria

Freelance Web Developer, Native Android Developer, and Coding Tutor.

Skills
  • UI / UX
  • JavaScript
  • Python
  • PHP
  • Kotlin
  • Java
  • Bootrap
  • Android
  • Laravel