Skip to main content
Practice

video Tag

The video tag creates an area for playing videos on a web page.

For example, you can embed a video on your web page as shown below:

Using the video Tag
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4" />
Your browser does not support the video tag.
</video>
  • width and height: Specify the size of the video player.

  • controls: Display video controls such as play/pause buttons.

  • <source>: Specifies the path and type of the video file.


Considerations When Using the <video> Tag

  1. File Formats: Video file formats supported by web browsers are not universally the same. Therefore, it is recommended to prepare multiple formats to ensure compatibility across different browsers.

  2. Alternative Text: The text written inside the video tag defines what is displayed in browsers that do not support video. It is good practice to include a description of the video here.

  3. Data Usage: Video files are large and can affect page loading speed. It is important to use them only where necessary and to compress the file size as much as possible.

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.