Adding Sound to Websites Using HTML

Learn how to incorporate background sound into your website using HTML and choose the right audio file format.


To add sound to a website, you should first pick a sound file. The .mid format (MIDI) is ideal because the sound is synthetic and generated directly by the sound card, resulting in a very small file that avoids long loading times. However, .wav files can also be used, though they contain original audio data and are therefore much larger.

The command is best placed right at the beginning of the document body.

Here is an example of the source code:

Source code example

This code assumes that the sound file is located in the same directory.








Adding Sound to Websites Using HTML


Learn how to incorporate background sound into your website using HTML and choose the right audio file format.


To add sound to a website, you should first pick a sound file. The .mid format (MIDI) is ideal because the sound is synthetic and generated directly by the sound card, resulting in a very small file that avoids long loading times. However, .wav files can also be used, though they contain original audio data and are therefore much larger.

The command is best placed right at the beginning of the document body.

Here is an example of the source code:

Source code example

This code assumes that the sound file is located in the same directory.

Adding Sound to Websites Using HTML

Learn how to incorporate background sound into your website using HTML and choose the right audio file format.
Adding Sound to Websites Using HTML
Adding Sound to Websites Using HTML
Recommend to friends
  • gplus
  • pinterest

Comment

Leave comment

Rating