HTML Audio Tag


The HTML <audio> tag is used to embed audio content into a webpage. It is a self-contained tag, meaning it does not require a closing tag. The <audio> tag has several attributes that can be used to customize the way the audio is displayed and played. In this tutorial, we’ll go over the basic syntax of the <audio> tag, as well as some of its most useful attributes.

Basic Syntax:

The basic syntax for the <audio> tag is as follows:

<audio src=”audiofile.mp3″>

This will embed an audio file called “audiofile.mp3” into the webpage. The audio file must be in a format that is supported by the web browser, such as MP3, WAV, or OGG. If the web browser does not support the format of the audio file, the user will not be able to play it.


There are several attributes that can be used with the <audio> tag to customize the way the audio is displayed and played. Some of the most useful attributes are:

  1. controls: This attribute adds controls to the audio player, such as play, pause, and volume.
Also Read:  kbd Tag in HTML

<audio src=”audiofile.mp3″ controls>

  1. autoplay: This attribute automatically plays the audio file when the page is loaded.

<audio src=”audiofile.mp3″ autoplay>

  1. loop: This attribute causes the audio file to loop continuously.

<audio src=”audiofile.mp3″ loop>

  1. preload: This attribute specifies whether the audio file should be preloaded when the page is loaded. It can be set to “none”, “metadata”, or “auto”.

<audio src=”audiofile.mp3″ preload=”auto”>

  1. muted: This attribute mutes the audio by default.

<audio src=”audiofile.mp3″ muted>

  1. src: This attribute specifies the URL of the audio file.

<audio src=”audiofile.mp3″>

  1. type: This attribute specifies the type of audio file.

<audio src=”audiofile.mp3″ type=”audio/mpeg”>

The <audio> tag is a useful tool for embedding audio content into a webpage. With its customizable attributes, you can control the way the audio is displayed and played, making for a better user experience. By understanding the basic syntax and attributes of the <audio> tag, you can incorporate audio files into your webpages and enhance their functionality.

Previous articleAside HTML Tag
Next articleB Tag in HTML
Namaskaar, Friends main Kapil ka Founder hu. Mere kai English blog bhi hai ,par mera motive yahan par easy language mein Technology se related Gyan ko aap tak pahunchane ka hai .taki aap kuch naya shikh sake. meri koshish hai ki bilkul simple tarike se aap ko nyi updates deta rahu taki aap bhi technology ke is yug mein peeche na rahe aur shikte rahe.Mujhse judne ke liye app mujhe Social Media par follow kar sakte hai.


Leave a Reply