Tag bgsoud

⚠️ Status: Deprecated (Obsolete)

The <bgsound> tag was a non-standard HTML element introduced by Internet Explorer to play background audio automatically when a web page loads.

❌ It is not supported in modern browsers and should not be used in modern websites.


🧪 Syntax

<bgsound src="music.mp3" loop="infinite">

Attributes:

  • src — path to the sound file
  • loop — number of times to repeat (use "infinite" or a number)

📌 Example (Old Usage)

<bgsound src="background.mp3" loop="infinite">

This would play background.mp3 automatically and loop it forever (but only in old Internet Explorer versions).


🚫 Why Not Use <bgsound>?

  • Not part of HTML5
  • Only worked in Internet Explorer
  • No support in Chrome, Firefox, Safari, Edge
  • Bad for accessibility and user control

✅ Modern Alternative: <audio>

Use the standard HTML5 <audio> tag instead, which works across all modern browsers:

<audio src="background.mp3" autoplay loop hidden></audio>

You can also give users playback controls:

<audio controls>
<source src="background.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>

✅ Summary

Feature<bgsound><audio>
Standard❌ No (IE only)✅ Yes (HTML5)
Browser supportVery limitedFull modern support
User controls❌ No✅ Optional

If you’re working on a retro-themed project or curious about web history, <bgsound> is a fun artifact — but for real projects, always use <audio>.