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

HTML reference manual

Complete list of HTML tags

Etichetta HTML: <audio>

The HTML <audio> element is used to represent audio content in a document. The <audio> element can contain multiple audio resources, which can be described using the src attribute or the <source> element; the browser will choose the most appropriate one to use. For browsers that do not support the <audio> element, the <audio> element can also be added to the document as content that the browser does not recognize.

Online example

Play sound:

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>Basic Tutorial Website (oldtoolbag.com)</title> 
</head>
<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 to see <‹/›

Browser compatibility

IEFirefoxOperaChromeSafari

IE 9+, Firefox, Opera, Chrome and Safari all support the <audio> tag.

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

Tag definition and usage instructions

The <audio> tag defines sound, such as music or other audio streams.
At the moment, the <audio> element supports 3 file formats: MP3, WAV and OGG.

BrowserMP3WavOgg
Internet ExplorerNONO
Chrome
Firefox
SafariNO
Opera

Differenze tra HTML 4.01 e HTML5

L'etichetta <audio> è una nuova etichetta in HTML5.

Suggerimenti e avvertenze

Attenzione:Qualsiasi testo tra <audio> e </audio> viene visualizzato nei browser che non supportano l'etichetta <audio>.

Proprietà

New: Proprietà nuove in HTML5.

ProprietàValoreDescrizione
autoplayHTML5autoplaySe presente, l'audio viene riprodotto immediatamente dopo che è pronto.
controlsHTML5controlsSe presente, viene visualizzato il controllo audio dell'utente (ad esempio, pulsante play/pausa).
loopHTML5loopSe presente, l'audio viene riprodotto ogni volta che termina.
mutedHTML5mutedSe presente, l'output audio è silenzioso.
preloadHTML5auto
metadata
none
Stabilisce se l'audio viene caricato per impostazione predefinita e come viene caricato quando la pagina web viene caricata.
srcHTML5URL Stabilisce l'URL del file audio.

Proprietà globali

Supporto <audio> etichetta Proprietà globali HTML.

Proprietà degli eventi

Supporto <audio> etichetta Proprietà degli eventi HTML.