HTML <video> tag
When writing in HTML, the <video> tag is an inline element used to embed video content into a web page. It is useful when you want to add any video, such as a music video or news report, to your web pages. The following sections contain information about this tag, including an example of it in use, as well as related attributes and browser compatibility.
Example of <video> code
Your browser does not support the <video> tag. <source src="../m/computer-hope.mp4" /> </video>
File formats and browser support
When utilizing the <video> tag, you need to ensure that your sound file is in the proper format. There are three accepted formats which include MP4, Ogg, and WebM. The table below shows which Internet browsers support which file format.
Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up of a name and value pair; all tags support standard attributes. The following table shows all of the current unique HTML attributes for the <video> tag, as well as a description of each.
|autoplay||Designates that the video will play immediately after it loads.|
|controls||Designates what controls to display with the video player.|
|height||Designates the height of the video player.|
|loop||Designates that the video should continuously repeat.|
|muted||Designates that the audio output should be muted.|
|poster||Designates an image to be shown while the video is downloading, or first loads.|
|preload||Designates how and when the video should load.|
|src||Designates the URL of the video.|
|width||Designates the width of the video player.|