HTML loop attribute

HTML 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>
 </video>
</>

The loop attribute represents that video plays automatically from the start when it reaches at the end.

Attribute values

All possible values of loop attribute

loop attribute is a boolean attribute.

Related Tags

The tags that support loop attribute

<video> tag

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

<audio> tag

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

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

Summary

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?

 

Email:

Message: