HTML - <bgsound> Tag



The HTML <bgsound> tag is used to play a soundtrack in the background.

The <bgsound> tag is introduced by the microsoft into the internet explorer, so no other browsers support it.

Example

Let's look at the following example, where we are going to use bgsound tag in the HTML document

<!DOCTYPE html>
<html>

   <head>
      <title>HTML bgsound Tag</title>
   </head>

   <body>
      <bgsound src = "/html/yourfile.mdi"/>
      
      <p>This does create any result on the screen but it plays sound file
         in the background.</p>
   </body>

</html>

When we run the above code, it will generate an output consisting of the text and plays sound file in the background.

Specific Attributes

The HTML <bgsound> tag also supports the following additional attributes −

Attribute Value Description
loop number Lets you replay a background soundtrack a certain number of times.
src URL Specifies the path of the sound file.
Advertisements