HTML <audio> tag

You are Here:

HTML <audio> tag

The <audio> tag is used to add audio files to an HTML document.

The <audio> tag may contain one or more audio sources using <source> element: the browser will choose the most suitable one.

The text between the <audio> and </audio> will be displayed in browsers that do not support the <audio> tag.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <audio controls> <source src="/mario.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio> </body> </html>

Attributes

The following are the attributes of <audio> tag. Also try Global attributes.

AttributeValueExplanation
autoplay-Specifies that the audio will start playing as soon as it is ready (audio start before the complete buffer as like youtube videos).
controls-Specifies that audio controls (Play/Pause/sound/download) should be displayed.
loop-Specifies that the audio will iterate for infinite times, from start to end, everytime when it finished.
muted-Specifies that the audio will be initially silenced.
preloadauto
metadata
none
This attribute is intended to provide a hint to the web browser about what the author thinks will lead to the best user experience.
srcURLSpecifies the URL of the audio to embed.

Reminder

Hi Developers, we almost covered 99.5% of HTML Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in HTML.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author