The HTML loop attribute
Quick answer
The HTML loop attribute restarts the media from the beginning when it reaches the end. It is used on the <audio> and <video> elements.
Overview
The loop attribute replays media from the start when it ends. It is used on the <audio> and <video> elements.
It configures native audio or video playback: the source, controls, autoplay and looping behavior, the poster image, and text tracks. It works with the <video>/<audio> elements and their nested <source> and <track> children.
Syntax
<video src="clip.mp4" loop muted></video>
Values
| Value |
|---|
| A boolean attribute: present or absent. |
Best practices
Frequently asked questions
What does the loop attribute do?
Replays media from the start when it ends.
Why won't my video autoplay?
Browsers block autoplay with sound. The media must be muted to autoplay.
How do I make media accessible?
Add captions via a <track>, and provide a transcript for audio-only content.
Which elements use the loop attribute?
It is an element-specific attribute, used on the
<audio> and <video> elements.