HTML CSS Bootstrap Javascript Icons Python
HTML References
HTML - Tag Reference HTML - Tag by Category HTML - Attributes HTML - Global Attributes HTML - Events HTML - Language Codes HTML - Country Codes HTML - URL Encoding HTTP Methods HTTP Status Codes <input> types
All HTML Tags
<!-- --> <!DOCTYPE> <a> <abbr> <acronym> <address> <applet> <area> <article> <aside> <audio> <b> <base> <basefont> <bdi> <bdo> <big> <blockquote> <body> <br> <button> <canvas> <caption> <center> <cite> <code> <col> <colgroup> <data> <datalist> <dd> <del> <details> <dfn> <dialog> <dir> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <font> <footer> <form> <frame> <frameset> <h1> - <h6> <head> <header> <hr> <html> <i> <iframe> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <main> <map> <mark> <meta> <meter> <nav> <noframes> <noscript> <object> <ol> <optgroup> <option> <output> <p> <param> <picture> <pre> <progress> <q> <rp> <rt> <ruby> <s> <samp> <script> <section> <select> <small> <source> <span> <strike> <strong> <style> <sub> <summary> <sup> <svg> <table> <tbody> <td> <template> <textarea> <tfoot> <th> <thead> <time> <title> <tr> <track> <tt> <u> <ul> <var> <video> <wbr>

HTML <audio> tag

The HTML <audio> element is used to embed audio in web pages.

It may contain one or more audio sources, represented using the src attribute or the <source> element: the browser will choose the most suitable one.

Run code

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

Browser compatibility

The numbers in the table specify the first browser version that fully supports the <audio> element:

Element
<audio> 3 3.5 10.5 3.1 9



Media Types

File Format Media Type
MP3 audio/mpeg
OGG audio/ogg
WAV audio/wav

Attributes

The following table shows the attributes that are specific to the <audio> tag:

Attribute Value Description
autoplay - A boolean attribute; if specified, the video or audio automatically begins to play back as soon as it can do so without stopping to finish loading the data
controls - A boolean attribute if this attribute is present, the browser will offer controls to allow the user to control audio/video playback, including volume, seeking, and pause/resume playback
loop - A boolean attribute; if specified, the browser will automatically seek back to the start upon reaching the end of the video/audio
muted - A boolean attribute specifies that the audio should be muted
preload
auto
metadata
none
This enumerated attribute is intended to provide a hint to the browser about what the author thinks will lead to the best user experience
src URL Specifies the URL of the audio file

Global Attributes

The <audio> tag supports the global attributes described in HTML Global Attributes Reference

Event Attributes

The <audio> tag supports the event attributes described in HTML Events Reference


More Examples

The autoplay attribute specifies that the audio automatically begins to play back as soon as it can do so without stopping to finish loading the data:

Run code

The loop attribute specifies that the browser will automatically seek back to the start upon reaching the end of the audio:

Run code

Last updated: Monday 17 Sep, 2018