Deprecated in HTML5. Do not use.

<bgsound> HTML Tag

Element of
HTML Media
What does <bgsound> HTML Tag do?
The <bgsound> element was used to embed a background audio track in an HTML document. It was only ever properly implemented in Internet Explorer and is no longer supported. The <audio> element can now be used to add background sounds, but audio tracks that autoplay and cannot be disabled by the user are strongly discouraged in modern web design.
Null element
This element must not contain any content, and does not need a closing tag.

Proprietary Element

The <bgsound> element was never a part of the HTML specification. We have it listed as “deprecated,” because that’s where we put features not included in HTML5, but actually it wasn’t deprecated because it was never there to begin with. The <bgsound> element was introduced by Microsoft into the Internet Explorer browser. It allowed web designers to add a background audio loop to a website. This audio loop would, of course, only be heard when visiting the site with Internet Explorer. (Which is surely a good reason to switch over to Netscape.)

Embedding audio on a page

The HTML5 way to embed audio on a page is to use the <audio> element.

<audio controls id="audio-example">    <source src="/wp-content/uploads/flamingos.mp3">     You will see this text if native audio playback is not supported. </audio>  <small>Audio by  <a href="">Beeld en Geluid</a> [<a href="">CC BY-SA 3.0</a>], <a href="'s_-_SoundCloud_-_Beeld_en_Geluid.ogg">via Wikimedia Commons</a></small> 
#audio-example { display: block; } Audio by Beeld en Geluid [CC BY-SA 3.0], via Wikimedia Commons

The right way to do the wrong thing

Causing a browser to play audio automatically is a terrible idea. It annoys users, leading them to quickly search for the offending browser tab and close it down. The only thing worse than automatically launching an audio playback is doing so while hiding the controls of the player, so that the user cannot shut it off. And the only thing worse than that is setting the audio to loop indefinitely. That is precisely what the <bgsound> element accomplished. If you would like to annoy people and drive them off of your website, you create the same effect as <bgsound> using the updated HTML5 audio feature. Simply set the <audio> element to autoplay and loop while excluding the controls attribute.

<!-- Do not do this. -->  <audio loop autoplay id="audio-example">    <source src="/wp-content/uploads/flamingos.mp3"> </audio> 
No demo provided, because that is a terrible thing to do.
Adam is a technical writer who specializes in developer documentation and tutorials.