HTML video Tag loop Attribute Tutorial

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

What is loop Attribute in HTML <video> Tag?

When adding a <video> element to a webpage and hit the play button, the video file plays only once! So basically, each time you want to watch the video, you need to hit the play button again.

But with the help of `loop` attribute, we can set a video file to play in a loop. This means every time the video reached to the end of itself, it will replay and start from the beginning.

HTML loop Attribute in <video> Tag Syntax:

<video loop> </video>

<video> Tag loop Attribute Values

The `loop` attribute does not take any argument as its value and we only need to add the attribute to the opening tag of HTML <video>.

Example: using loop attribute in HTML <video> tag

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

Here, let the video to play, and when it finished, it will start all over again.

Leave a Reply