CSS Portal

HTML loop Attribute

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
loop
HTML AttributeThis attribute is supported by all modern browsers.
Updated 29th March 2024

Description

The loop attribute in HTML is a boolean attribute used with media elements like <video> and <audio>. When present, it indicates that the media will start over again, automatically, from the beginning once it has finished playing. Essentially, it allows the media to loop continuously until it is explicitly stopped by the user or via JavaScript. This attribute can enhance user experience in specific contexts, such as background videos or ambient music on a webpage, where continuous playback is desired. The syntax for using the loop attribute is straightforward; you simply include it within the opening tag of the <video> or <audio> element, like so: <video src="movie.mp4" loop></video>. Note that the loop attribute does not require a value to be set; its presence alone activates the looping functionality.

Syntax

<tagname loop>

Values

The loop attribute is a boolean attribute, therefore no values are associated with this attribute.

Applies To

Example

<video controls loop>
<source src="images/earth.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
Open in editor

Browser Support

The following information will show you the current browser support for the HTML loop attribute. Hover over a browser icon to see the version that first introduced support for this HTML attribute.

This attribute is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee