HTML <audio> loopAttribute

HTML audio 标签参考手册HTML <audio> Tag

Examples

Set audio to loop:

<audio controls loop>
  <source src="horse.ogg.html" type="audio/ogg">
  <source src="horse.mp3.html" type="audio/mpeg">
Your browser does not support the audio element.
</audio>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 9+, Firefox, Opera, Chrome, and Safari support the loop attribute.

Note:Internet Explorer 8 and earlier IE browsers do not support the <audio> tag.


Definition and Usage

The loop attribute is a boolean attribute.

If this attribute is set, the audio will loop.


Differences between HTML 4.01 and HTML5

The <audio> tag is new in HTML5.


Differences between HTML and XHTML

In XHTML, this attribute is not allowed to be abbreviated, and the loop attribute must be defined as <audio loop="loop">.


Syntax

<audio loop>


HTML audio 标签参考手册HTML <audio> Tag

Other Extensions