How to display video in html?

Member

by domenico , in category: HTML & CSS , 10 months ago

How to display video in html?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by ryan.murray , 10 months ago

@domenico 

To display a video in HTML, you can use the element. Here is an example code to display a video:

1
2
3
4
<video width="320" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video>


In the above code:

  • The width and height attributes set the dimensions of the video player.
  • The controls attribute adds playback controls (play, pause, volume, etc.) to the video player.
  • The element specifies the video file to be displayed and its type. You can specify multiple elements to provide alternative video formats for compatibility with different browsers.
  • The text "Your browser does not support the video tag." is displayed if the browser does not support the video tag.


You can customize the appearance and behavior of the video player using CSS and JavaScript.