Bringing Sounds


  1. Background Sounds
  2. The width and height Attributes
  3. Useful Tips

Background Sounds

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 "source").

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:

        <embed src="url">
      

The only required attribute for <embed> is src, but there are others.

So, let's see some of them.


The width and height Attributes

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 width and 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.


Useful Tips

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.