HTML loop attribute

loop attribute plays media(video or audio) again from the start when it reaches at the end.


<p>The loop attribute represents that video plays automatically from the start when it reaches at the end.</p>
 <video src="files/Hummingbird.mp4"  height="300" width="300" controls loop>
Try </>

loop attribute values

loop attribute is a boolean attribute.

Related Tags

The tags which support this attribute are as follows.

<video> tag

video tag adds video in a page. loop attribute is applicable on the video tag.

See thea above given example.

<audio> tag

audio tag adds audio in a page. audio supports the loop attribute.


<audio src="files/sample.mp3" controls loop> </audio>



src attribute defines the location of the media.

width and height represent the horizontal and vertical dimensions of the media (video/audio).

controls attribute adds controls in the media. The browser adds its own controls.

In the above example, the video seeks back to the start after reaching at the end.

Was this article helpful?




Get the newsletter