ad

Sunday, October 19, 2025

Learn HTML audio Tag

Learn HTML audio  Tag 


web designing Theory  website

Learn HTML audio  Tag 

The <audio> has been added to HTML5 to allow embedding audio files to a web page.  not all browsers support all audio format the audio file is encoded using special codecs. The <source> tag or the src attribute is used to indicate the variations of the same audio file. The path to  audio file can contain absolute  and relative URLS.


Syntax: The <audio> tag comes in pairs; the content is written between the opening (<audio>) and the closing (</audio>) tags.


Learn HTML audio  Tag 

Example 

<html>

Click the play button

 <title>Title of the document</title>

 <head>

 </head>

<body>

<audio controls>

 <source src="/desktop/audio_friendship.mp3" type="audio">

</audio>

<P>click the Play button</p>

</body>

</html>

Learn HTML audio  Tag 

Explain program 

Step 1 ]

<!Doctype html>

  • <!doctype html>  always be the first line of any HTML document.

Step 2 ]

   <html> and </html>

   html  is the root element.

Step 3 ]

<body> and </body>

body  is  main content area.

All visible content inside to  the <body> tag

Step 4]

<audio controls>

create audio player the page

controls attribute add play/pause button

Step 5]

<source src="/desktop/audio_friendship.mp3" type="audio">
 
src   :-  file pointer to the location (here desktop/audio_friendship.mp3)


Learn HTML audio  Tag 

Output 

learn html Audio Tag

Related Post :-




No comments:

Post a Comment