HTML video Tag src Attribute Tutorial

In this section, we will learn what the src attribute is and how to use it.

What is src Attribute in HTML <video> Tag?

The HTML <video> element on its own doesn’t do much if we don’t provide it with a video file to work with.

We can set a video file for the HTML <video > element with the help of `src` attribute.

Basically, the value of this attribute is the URL address of the target video file that we want to display on our video player.

Note: using the src attribute we can only pick one video format which might not be supported by all browsers! For these reasons, developers usually use HTML <source> element instead, which allows them to set multiple formats for the same video file!

HTML src Attribute in <video> Tag Syntax:

<video src = “video file address”> </video>

<video> Tag src Attribute Values

The src attribute takes a string value which is the URL of the target video file that we want it to be played on the webpage.

Example: using src attribute in HTML <video> tag

See the Pen using src attribute in HTML <video> tag by Omid Dehghan (@odehghan) on CodePen.


Top Technologies