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

Manual de referência HTML

大全 de etiquetas HTML

Tag <audio> do HTML

O elemento <audio> do HTML é usado para representar conteúdo de áudio em documentos. O elemento <audio> pode conter múltiplos recursos de áudio,que podem ser descritos usando a propriedade src ou o elemento <source>;o navegador escolherá o mais apropriado para usar. Para navegadores que não suportam o elemento <audio>,o elemento <audio> também pode ser adicionado ao documento como conteúdo não reconhecido pelo navegador.

Exemplo online

Reprodução de som:

!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>Site de Tutoriais Básicos (oldtoolbag.com)</title> 
</head>
<body>
<audio controls>
  <source src="horse.ogg" type="audio/ogg">
  <source src="horse.mp3" type="audio/mpeg">
  Seu navegador não suporta o elemento audio.
</audio>
</body>
</html>
Teste e veja ‹/›

Compatibilidade do navegador

IEFirefoxOperaChromeSafari

IE 9+、Firefox、Opera、Chrome e Safari todos suportam a tag <audio>.

Notas: IE 8 ou versões mais antigas do navegador IE não suportam a tag <audio>.

definição e instruções de uso da tag

A tag <audio> define sons,por exemplo,música ou outros fluxos de áudio。
Atualmente,o elemento <audio> suporta3formatos de arquivo: MP3,WAV e Ogg。

navegadorMP3WavOgg
Internet ExplorerYESNONO
ChromeYESYESYES
FirefoxYESYESYES
SafariYESYESNO
OperaYESYESYES

HTML 4.01 with HTML5differences

The <audio> tag is a part of HTML5New tag in

Tips and notes

Note:and </ Any text between <audio> and <

Attribute

New: HTML5 New attribute in

AttributeValueDescription
autoplayHTML5autoplayIf this attribute is present, the audio is played immediately after it is ready.
controlsHTML5controlsIf this attribute is present, the audio control is displayed to the user (for example, play/Pause button).
loopHTML5loopIf this attribute is present, the audio is replayed every time it ends.
mutedHTML5mutedIf this attribute is present, the audio output is silent.
preloadHTML5auto
metadata
none
Specifies whether the audio is loaded by default when the web page is loaded and how it is loaded.
srcHTML5URL Specifies the URL of the audio file.

Global attributes

Support for <audio> tag Global attributes of HTML.

Event attributes

Support for <audio> tag HTML event attributes.