English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag大全

HTML: <audio> controls attribute

The controls attribute is a boolean attribute; if the attribute is present, it specifies how the audio controls are displayed; audio controls include: play, pause, progress bar, volume

HTML <audio> tag

Online Example

An <audio> element with browser default controls:

<!DOCTYPE html>
<html>
<title>HTML:<audio> controls attribute - 基础教程网 oldtoolbag.com</title>
<body>
<audio controls>
  <source src="horse.ogg" type="audio/ogg">
  <source src="horse.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>
</body>
</html>
Test it out ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

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

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

Definition and Usage

The controls attribute is a boolean attribute.

If the attribute exists, it specifies how the audio control is displayed.

Audio/Video controls include:

  • Play

  • Pause

  • Progress bar

  • Volume

HTML 4.01 versus HTML5differences

<audio> element is HTML5Newly added.

Difference between HTML and XHTML

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

Syntax

        <audio controls>

HTML <audio> tag