The best HTML <audio> tag Tutorial In 2024, In this tutorial you can learn Examples,Browser Support,Tag definitions and instructions,Differences between HTML 4.01 and HTML5,Tips and Notes,Attributes,Global Properties,Event Properties,
Play sound:
IE 9 +, Firefox, Opera, Chrome and Safari support the <audio> tag.
Note: IE 8 or earlier versions of IE browser does not support the <audio> tag.
<Audio> tag defines sound, such as music or other audio streams.
Currently, <audio> element supports three file formats: MP3, Wav, Ogg.
Browser | MP3 | Wav | Ogg |
---|---|---|---|
Internet Explorer | YES | NO | NO |
Chrome | YES | YES | YES |
Firefox | YES | YES | YES |
Safari | YES | YES | NO |
Opera | YES | YES | YES |
<Audio> tag HTML5 is the new label.
Tip: You can place text in <audio> and </ audio> between, these text messages will be displayed in those who do not support the <audio> tag browser.
New: HTML5 new property.
属性 | 值 | 描述 |
---|---|---|
autoplay New | autoplay | 如果出现该属性,则音频在就绪后马上播放。 |
controls New | controls | 如果出现该属性,则向用户显示音频控件(比如播放/暂停按钮)。 |
loop New | loop | 如果出现该属性,则每当音频结束时重新开始播放。 |
muted New | muted | 如果出现该属性,则音频输出为静音。 |
preload New | auto metadata none |
规定当网页加载时,音频是否默认被加载以及如何被加载。 |
src New | URL | 规定音频文件的 URL。 |
<audio> tag supports HTML global properties .
<audio> tag supports HTML event properties .