<audio>...</audio>

HTML4 HTML5

Used to embed audio files (e.g., music, podcasts) into a webpage.

Both opening and closing tags are required.

Attributes:

controls - Displays default browser media controls (play button, progress bar, volume controls).

autoplay - Automatically starts playing audio upon page load (often blocked by modern browsers).

loop - Causes the audio to replay continuously.

muted - Mutes the sound by default when the player loads.

Example

Code:

<audio controls style="width: 100%; max-width: 300px;"> <source src="https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio>

The browser will interpret this code as follows: