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.
html
<!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.
html
<!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:
- Google Chrome 4.0/4.0
- Internet Explorer 9.0/9.0
- Firefox 3.5/11.0
- Apple Safari 4.0/4.0
- Opera 10.5/10.5