Skip to main content
Practice

video Tag

The video tag creates an area on your web page for video playback.

For example, you can embed a video in a 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 dimensions of the video player

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

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


Considerations When Using the <video> Tag

  1. File Format: Not all video file formats are supported by every browser. Therefore, it's a good practice to prepare multiple video file formats to ensure compatibility.

  2. Alternative Text: The text inside the video tag provides fallback content for browsers that do not support the video element. It's helpful to describe the video content here.

  3. Data Usage: Video files can be large, which may affect page loading times. Use videos only when necessary and compress files to keep their size manageable.

Want to learn more?

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