HTML - <bgsound> Tag



HTML <bgsound> tag is used to play a soundtrack in the background. If we open any tab that contain this tag will play a background musin on that tab.

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

Syntax

<bgsound src="">

Attribute

HTML bgsound tag supports Global and Event attributes of HTML. Accepts some specific attributes as well which are listed below.

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.

Examples of HTML bgsound Tag

Bellow example will illustrate the usage of bgsound tag. Where, when and how to use bgsound tag to embed sound in a website.

Embedding background Sound on Tab

Let's look at the following example, where we are going to use bgsound tag in the HTML document. When we run the above code, it will generate an output consisting of the text and plays sound file in the background.

<!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>

Supported Browsers

Tag Chrome Edge Firefox Safari Opera
bgsound No Yes No No No
html_tags_reference.htm
Advertisements