HTML loop Attribute
Last Updated :
29 Aug, 2024
Improve
The HTML loop Attribute is used to restart the audio and video again and again after finishing it. It contains the Boolean value.
Syntax:
<element loop>
Applicable
- <audio>
- <video>
- <marquee>
- <bgsound>
Example 1: Below Example illustrates the use of loop attribute in <audio> element.
<!DOCTYPE html>
<html>
<head>
<title>
Audio loop Attribute
</title>
</head>
<body style="text-align: center">
<h1 style="color: green">
GeeksforGeeks
</h1>
<h2 style="font-family: Impact">
HTML Audio loop Attribute
</h2>
<br>
<audio id="Test_Audio"
controls loop>
<source src="beep.mp3"
type="audio/mpeg">
</audio>
</body>
</html>
Output:

Example 2: Below Example illustrates the use of loop attribute in <video> element.
<!DOCTYPE html>
<html>
<head>
<title>
HTML video loop Attribute
</title>
</head>
<body>
<center>
<h1 style="color:green;">
GeeksforGeeks
</h1>
<h3>HTML video loop Attribute</h3>
<video width="400"
height="200"
controls loop>
<source src="Canvas.move_.mp4"
type="video/mp4">
<source src="Canvas.move_.ogg"
type="video/ogg">
</video>
</center>
</body>
</html>
Output:

Supported Browsers: The browsers supported by loop Attribute are listed below: