Audio Tag in HTML

Audio Tag

1. The <audio> tag was introduced in HTML5.

2. The <audio> tag is used to embed or attach audio to a web page.

3. It is a container tag.

4. It is a block-level element.

5. To mention the path of the audio, we have to use the <source> tag (which is a non-container tag).

6. In the <source> tag, we have to use the src attribute to provide the path of the audio.

7. We can provide multiple sources using multiple <source> tags.

8. The content written within the <audio> tag will be displayed when the browser does not support the audio tag.

9. Syntax: <audio> <source src='path-of-audio'> Audio tag is not supported by the browser. </audio>

Attributes Of Audio Tag

1. Controls - Enables the audio controls like play, pause, and volume.

2. Autoplay - Automatically plays the audio when the page loads.

3. Loop - Plays the audio continuously in a loop.

4. Muted - Mutes the audio.

Div and Span tags

They are used to create container, so that we can group the content apply styling

Div is the block level element whereas span is the inline element.