<audio> Tag in HTML

The <audio> tag in HTML is used to embed audio content, such as music or sound files, in a web page. It allows you to control the playback of audio directly from the browser without relying on external plugins.

Key Points on <audio> Tag:

Syntax of <audio> Tag:

Syntax Example

<audio controls>
            <source src="audiofile.mp3" type="audio/mp3">
            Your browser does not support the audio element.
        </audio>

Example of <audio> Tag in HTML:

This example demonstrates the use of the <audio> tag to embed a Hindi song with playback controls.

Code Example

<audio controls>
            <source src="https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3" type="audio/mp3">
            Your browser does not support the audio element.
        </audio>

Output

Attributes of <audio> Tag:

The <audio> tag is supported by most modern browsers, but it is always a good practice to provide fallback content or multiple audio formats (e.g., MP3, Ogg) for broader compatibility.