- Background Sounds
- Useful Tips
A "background sound" is a sound that starts to play automatically when the web page is loaded.
In HTML, sounds are defined with the < embed> tag.
The <embed > tag is another empty one, which means that it contains attributes only and may be closed on itself.
To play a song on a page, you need to use the
src attribute (
src stands for
The value of the src attribute is the URL of the song you want to be played on your page.
The syntax of defining a song:
The only required attribute for <embed>
src, but there are others.
So, let's see some of them.
In its simplest use, <embed>
we use the
src attribute to indicate the location of the plug-in data file.
But usually we also give the
height of the plug-in area.
Lets see another example:
<embed src="music/1812over.mid" alt="A good song" height = 60 width = 144>
<embed> isn't on the HTML 4 or xHTML 1 specifications, but it is widely supported by modern browsers.
Background Sounds must be used very carefully, they could be annoying.
Suppose someone is happily surfing the net, when suddenly their computer starts playing music for everyone to hear, perhaps everyone in the office area.
This will drive people to think, he isn't really working.