The <audio> tag in HTML is used to embed audio files or streams into a web page, allowing users to listen to audio content directly in the browser.
Here's a basic example of how the <audio> tag can be used:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTML Audio Tag Example</title>
</head>
<body>

    <h2>Audio Example</h2>

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

</body>
</html>

In this example:

  • The <audio> tag is used to define an audio player.
  • The controls attribute adds playback controls (play, pause, volume, etc.) to the audio player.
  • The <source> tag is used to specify the audio file and its type. In this case, it's an MP3 audio file.

You can replace "example.mp3" with the actual path to your audio file. As with video, providing multiple <source> elements with different audio formats (e.g., Ogg, WAV) is a good practice for better browser compatibility.