Summary -

In this topic, we described about the <bgsound> tag along with detailed example.

Deprecated in HTML5. The <bgsound> element was used to insert a background audio track in an HTML Page. The <bgsound> element was introduced by Microsoft into the Internet Explorer browser.

So no other browsers are supports the <bgsound> tag. It allowed web designers to add a background audio loop to a website in internet explorer. It is no longer supported.

This feature is non-standard and is not on a standards track. The <audio> element can be used to add background sounds instead of <bgsound> tag. But it has autoplay attribute and can’t be disabled.

Below are the attributes of bgsound.

AttributeDescription
Balance Defines the volume divided between the speakers.The values in between -10000 to +10000
Loop The attribute indicates the number of times a sound is to be playedThe values are numbers or "infinite"
Src Specifies the URL of the sound file
Volume Specifies the loudnessThe value is between -10000 and 0

Syntax -

<bgsound>….</bgsound>

Example -

<!DOCTYPE html>
<html>
	<head>
		<title>Bgsound tag example..</title>
	</head>
	<body>
		<bgsound src="audio/new.mpg">
	</body>
</html>

Output -

Background sound is not playing as bgsound tag not supporting in HTML5.